doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

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

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