Steven D'Aprano wrote:
Okay, if other people are doing it, I'm happy to rely on it as something
which shouldn't just go away without warning.
At least, it will not go away without fuss.
I would guess that modifying the message is an intended use of bare
'raise', but that is not documented.
Steven D'Aprano writes:
> Okay, if other people are doing it, I'm happy to rely on it as
> something which shouldn't just go away without warning. Thanks to
> everyone who replied.
If you only want to modify the exception's message string, the
‘message’ attribute is standard IIRC. No need to re-
Gabriel Genellina wrote:
> En Fri, 06 Mar 2009 04:29:16 -0200, Steven D'Aprano
> escribió:
...
>> The behaviour I want is from raise_example2, but I'm not sure if this is
>> documented behaviour, or if it is something I can rely on. Is it
>> acceptable to modify an exception before re-raising it?
Steven D'Aprano wrote:
> I wish to catch an exception, modify the error message, and re-raise it.
> There are two ways I know of to do this, with subtly different effects:
>
def raise_example1():
> ... try:
> ... None()
> ... except TypeError, e:
> ... e.args =
En Fri, 06 Mar 2009 04:29:16 -0200, Steven D'Aprano
escribió:
I wish to catch an exception, modify the error message, and re-raise it.
There are two ways I know of to do this, with subtly different effects:
def raise_example1():
... try:
... None()
... except TypeError,
On Thu, Mar 5, 2009 at 10:29 PM, Steven D'Aprano wrote:
> I wish to catch an exception, modify the error message, and re-raise it.
> There are two ways I know of to do this, with subtly different effects:
>
def raise_example1():
> ... try:
> ... None()
> ... except TypeErr