doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0274-python-provide-more-information-about-exception.patch

4b0da3
From e12300d1a8ec7e61db2838cb0b7c3dce193f1464 Mon Sep 17 00:00:00 2001
4b0da3
From: Martin Kutlak <mkutlak@redhat.com>
4b0da3
Date: Mon, 10 Apr 2017 13:56:17 +0200
4b0da3
Subject: [PATCH] python: provide more information about exception
4b0da3
4b0da3
Message was modified to provide more information about where exception happened.
4b0da3
4b0da3
$ python -c 1/0
4b0da3
4b0da3
Before:
4b0da3
python: detected unhandled Python exception
4b0da3
4b0da3
Now:
4b0da3
python: detected unhandled Python exception in 'interactive mode (python -c ...)'
4b0da3
4b0da3
Related to: #1361116
4b0da3
4b0da3
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
4b0da3
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
4b0da3
4b0da3
Conflicts:
4b0da3
	src/hooks/abrt_exception_handler3.py.in
4b0da3
	tests/runtests/python3-addon/runtest.sh
4b0da3
---
4b0da3
 src/hooks/abrt_exception_handler.py.in | 4 +++-
4b0da3
 1 file changed, 3 insertions(+), 1 deletion(-)
4b0da3
4b0da3
diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in
4b0da3
index 7455663..dacde37 100644
4b0da3
--- a/src/hooks/abrt_exception_handler.py.in
4b0da3
+++ b/src/hooks/abrt_exception_handler.py.in
4b0da3
@@ -220,7 +220,9 @@ def handleMyException((etype, value, tb)):
4b0da3
         ## argv0 is:-c
4b0da3
         # Are there other cases when sys.argv[0][0] is "-"?
4b0da3
         if not sys.argv[0] or sys.argv[0][0] == "-":
4b0da3
-            syslog("detected unhandled Python exception")
4b0da3
+            einfo = "" if not sys.argv[0] else " (python %s ...)" % sys.argv[0]
4b0da3
+            syslog("detected unhandled Python exception in 'interactive mode%s'"
4b0da3
+                   % einfo)
4b0da3
             raise Exception
4b0da3
 
4b0da3
         # Ignore scripts with relative path unless "RequireAbsolutePath = no".
4b0da3
-- 
4b0da3
1.8.3.1
4b0da3