X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Ferror.py;h=773586833b78c8cb81cdc58172716e72317b655c;hb=9813eca7029e47147014446c0ab6cf841e25472b;hp=dc1e65f55fb03b91e5f2af426468364bac05025c;hpb=7f47aa068c5d4ac1d37bf4f5df6c9320b0d6d3ad;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/error.py b/src/bindings/python/bt2/bt2/error.py index dc1e65f5..77358683 100644 --- a/src/bindings/python/bt2/bt2/error.py +++ b/src/bindings/python/bt2/bt2/error.py @@ -168,6 +168,8 @@ class _Error(Exception, abc.Sequence): self._ptr = native_bt.current_thread_take_error() assert self._ptr is not None + self._msg = msg + # Read everything we might need from the error pointer, so we don't # depend on it. It's possible for the user to keep an Error object # and to want to read its causes after the error pointer has been @@ -208,3 +210,9 @@ class _Error(Exception, abc.Sequence): def __len__(self): return len(self._causes) + + def __str__(self): + s = self._msg + '\n' + for c in self: + s += str(c) + '\n' + return s