summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rdiff-backup/rdiff_backup/log.py11
-rw-r--r--rdiff-backup/rdiff_backup/robust.py13
-rw-r--r--rdiff-backup/src/log.py11
-rw-r--r--rdiff-backup/src/robust.py13
4 files changed, 32 insertions, 16 deletions
diff --git a/rdiff-backup/rdiff_backup/log.py b/rdiff-backup/rdiff_backup/log.py
index 1e5998e..4e7cbe3 100644
--- a/rdiff-backup/rdiff_backup/log.py
+++ b/rdiff-backup/rdiff_backup/log.py
@@ -145,11 +145,14 @@ class Logger:
Main.cleanup()
sys.exit(1)
- def exception_to_string(self):
- """Return string version of current exception"""
+ def exception_to_string(self, arglist = []):
+ """Return string version of current exception plus what's in arglist"""
type, value, tb = sys.exc_info()
- return ("Exception '%s' raised of class '%s':\n%s" %
- (value, type, "".join(traceback.format_tb(tb))))
+ s = ("Exception '%s' raised of class '%s':\n%s" %
+ (value, type, "".join(traceback.format_tb(tb))))
+ if arglist:
+ s += "__Arguments:\n" + "\n".join(map(str, arglist))
+ return s
def exception(self, only_terminal = 0, verbosity = 5):
"""Log an exception and traceback
diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py
index cecd33c..97bfb50 100644
--- a/rdiff-backup/rdiff_backup/robust.py
+++ b/rdiff-backup/rdiff_backup/robust.py
@@ -255,7 +255,7 @@ class Robust:
except (EnvironmentError, SkipFileException, DSRPPermError,
RPathException, Rdiff.RdiffException,
librsync.librsyncError, C.UnknownFileTypeError), exc:
- TracebackArchive.add()
+ TracebackArchive.add([function] + args)
if (not isinstance(exc, EnvironmentError) or
(errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
@@ -300,9 +300,14 @@ class SignalException(Exception):
class TracebackArchive:
"""Save last 10 caught exceptions, so they can be printed if fatal"""
_traceback_strings = []
- def add(cls):
- """Add most recent exception to archived list"""
- cls._traceback_strings.append(Log.exception_to_string())
+ def add(cls, extra_args = []):
+ """Add most recent exception to archived list
+
+ If extra_args are present, convert to strings and add them as
+ extra information to same traceback archive.
+
+ """
+ cls._traceback_strings.append(Log.exception_to_string(extra_args))
if len(cls._traceback_strings) > 10:
cls._traceback_strings = cls._traceback_strings[:10]
diff --git a/rdiff-backup/src/log.py b/rdiff-backup/src/log.py
index 1e5998e..4e7cbe3 100644
--- a/rdiff-backup/src/log.py
+++ b/rdiff-backup/src/log.py
@@ -145,11 +145,14 @@ class Logger:
Main.cleanup()
sys.exit(1)
- def exception_to_string(self):
- """Return string version of current exception"""
+ def exception_to_string(self, arglist = []):
+ """Return string version of current exception plus what's in arglist"""
type, value, tb = sys.exc_info()
- return ("Exception '%s' raised of class '%s':\n%s" %
- (value, type, "".join(traceback.format_tb(tb))))
+ s = ("Exception '%s' raised of class '%s':\n%s" %
+ (value, type, "".join(traceback.format_tb(tb))))
+ if arglist:
+ s += "__Arguments:\n" + "\n".join(map(str, arglist))
+ return s
def exception(self, only_terminal = 0, verbosity = 5):
"""Log an exception and traceback
diff --git a/rdiff-backup/src/robust.py b/rdiff-backup/src/robust.py
index cecd33c..97bfb50 100644
--- a/rdiff-backup/src/robust.py
+++ b/rdiff-backup/src/robust.py
@@ -255,7 +255,7 @@ class Robust:
except (EnvironmentError, SkipFileException, DSRPPermError,
RPathException, Rdiff.RdiffException,
librsync.librsyncError, C.UnknownFileTypeError), exc:
- TracebackArchive.add()
+ TracebackArchive.add([function] + args)
if (not isinstance(exc, EnvironmentError) or
(errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
@@ -300,9 +300,14 @@ class SignalException(Exception):
class TracebackArchive:
"""Save last 10 caught exceptions, so they can be printed if fatal"""
_traceback_strings = []
- def add(cls):
- """Add most recent exception to archived list"""
- cls._traceback_strings.append(Log.exception_to_string())
+ def add(cls, extra_args = []):
+ """Add most recent exception to archived list
+
+ If extra_args are present, convert to strings and add them as
+ extra information to same traceback archive.
+
+ """
+ cls._traceback_strings.append(Log.exception_to_string(extra_args))
if len(cls._traceback_strings) > 10:
cls._traceback_strings = cls._traceback_strings[:10]