[issue6210] Exception Chaining missing method for suppressing context

Matthew Barnett report at bugs.python.org
Wed Mar 16 20:45:46 CET 2011


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

I've been looking through the list of current keywords and the best syntax I could come up with for suppressing the context is:

    try:
        x / y
    except ZeroDivisionError as e:
        raise as Exception( 'Invalid value for y' )

The rationale is that it's saying "forget about the original exception (if any), raise _as though_ this is the original exception".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6210>
_______________________________________


More information about the Python-bugs-list mailing list