How do I know all thrown exceptions of a function?

Darren New dnew at san.rr.com
Tue Jan 23 18:38:17 EST 2001


D-Man wrote:
> I agree that it is ugly to have to declare all possible exception
> types.  That's not to say you shouldn't document it, but it should be
> /documented/ not forced by the /compiler/.

The other problem, of course, is using frameworks. When library code calls
yours, and you want to debug what it's doing, it's very difficult. If you
(for example) get an IOException in your code, and the library doesn't
accept your function throwing that error, you have to catch it there instead
of propagating it upwards to be caught in your code that calls the library.

MyCode ()
   YourCode()
     MyOtherCode()

MyOtherCode has to handle every error, instead of letting MyCode handle
some.

-- 
Darren New / Senior MTS & Free Radical / Invisible Worlds Inc.
San Diego, CA, USA (PST).  Cryptokeys on demand.
"It says this wine has syphilis."
               "I think that's pronounced `sulphates'."



More information about the Python-list mailing list