Ticket #581 (new enhancement )

Opened 5 years ago

Last modified 4 years ago

[PATCH] print more information for copied failures

Reported by: titty Assigned to: warner
Type: enhancement Priority: low
Milestone: Component: pb
Keywords: Cc: warner, titty
Branch: Author:
Launchpad Bug:

Attachments

Change History

  2004-04-03 22:55:30+00:00 changed by titty

When an error occurs using pb, one sees messages like the following:
CopiedFailure: [Failure instance: Traceback from remote host -- Traceback
unavailable
They are not very informative, more information is available and should also be
printed:
Index: twisted/python/failure.py
===================================================================
--- twisted/python/failure.py   (revision 10463)
+++ twisted/python/failure.py   (working copy)
@@ -250,7 +250,7 @@
         return "<%s %s>" % (self.__class__, self.type)
     def __str__(self):
-        return "[Failure instance: %s]" % self.getBriefTraceback()
+        return "[Failure instance: %s: %s: %s]" % (self.type,
self.getErrorMessage(), self.getBriefTraceback())
     def __getstate__(self):
         """Avoid pickling objects in the traceback.

  2004-09-20 22:44:02+00:00 changed by hypatia

Assign to warner

  2004-09-22 03:31:55+00:00 changed by warner

Could you look at broker.unsafeTracebacks and see if it provides what you want?
The idea is that you don't want to reveal a whole lot about the remote end by
default. If you do, you set .unsafeTracebacks=True .
That said, I'm not sure it's implemented correctly. (I've been trying to improve
on this in newpb, where it is easier to control how Failures get serialized).

  2005-04-01 20:38:14+00:00 changed by titty

Never seen that unsafeTracebacks flag before. Thanks for the tip.
But the problem occurs when unsafeTracebacks is not set. I'd like to print a
failure object, and all I see is "[Failure instance: Traceback from remote host
-- Traceback unavailable]". I could print failure.type,
failure.getErrorMessage()..but it's just not as simple as it ought to be.
btw, is newpb already usable and what other advantages does it provide?

  2005-04-14 03:43:56+00:00 changed by titty

when one doesn't handle errors in deferreds (using pb, i.e. CopiedFailure),
twisted from svn (r13537) just prints:
'Unhandled error in Deferred:'
no traceback, no getErrorMessage(), nothing else.
guess this isn't helpful at all...
Note: See TracTickets for help on using tickets.