[Python-3000] self-contained exceptions

Guido van Rossum guido at python.org
Thu Jan 4 19:21:28 CET 2007


[Tomer]
> > > as well as
> > > traceback.format_exception (which i greatly dislike).

[Guido]
> > Why? Because it once insulted you?

[Tomer]
> because it's tedious, repetitive and unreadable.
>
> try:
>     foo
> except:
>     import traceback
>     import sys
>     tbtext = "".join(traceback.format_exception(*sys.exc_info()))
>     raise RemoteException(tbtext)
>
> it ought to have at least a nicer API, for instance,
> tbtext = traceback.format_current()

I don't really think you can blame format_exception() for returning a
list. The use case I am guessing from your example (passing a
traceback as a single string across an RPC boundary) isn't all that
common and you ought to have only one place in your RPC package where
you need to call it.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list