[BangPypers] Nested try-catch

steve steve at lonetwin.net
Wed Oct 7 08:35:18 CEST 2009


On 10/07/2009 10:24 AM, Anand Chitipothu wrote:
> [...snip...]
> When an exception is raised, traceback is taken from the current stack
> unless a traceback object is provided to it. I'm using sys.exc_info()
> to get the trackback of the original exception and using it when
> re-raising the exception.
>
Ah ok. I assumed you were only interested catching exceptions rather than the 
exception itself, since you were using a blanket except statement.

> http://docs.python.org/reference/simple_stmts.html#raise
>
> And there is no need to add "saved = e" as the exception is already
> available as variable e.

yeah, yeah :) ...that was just pseudo code to emphasize the fact that the object 
is available. In any case, if you really want to be pedantic, you ought to be 
raising custom exceptions rather than the base Exception object and also 
catching specific exceptions rather than a blanket except !

cheers,
- steve

-- 
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/


More information about the BangPypers mailing list