Re: Modify an exception before re-raising it

2009-03-06 Thread Terry Reedy
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.

Re: Modify an exception before re-raising it

2009-03-06 Thread Ben Finney
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-

Re: Modify an exception before re-raising it

2009-03-06 Thread Steven D'Aprano
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

Re: Modify an exception before re-raising it

2009-03-05 Thread Steve Holden
e_example2() > Traceback (most recent call last): > File "", line 1, in ? > File "", line 3, in raise_example2 > TypeError: modified error message > > Note how the line numbers in the traceback are different. > > The behaviour I want is from raise_e

Re: Modify an exception before re-raising it

2009-03-05 Thread Gabriel Genellina
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? I don't completely understand your question. Is it about the bare raise? It is docum

Re: Modify an exception before re-raising it

2009-03-05 Thread Chris Rebert
sage >>>> raise_example2() > Traceback (most recent call last): >  File "", line 1, in ? >  File "", line 3, in raise_example2 > TypeError: modified error message > > Note how the line numbers in the traceback are different. > > The behaviour I wan

Modify an exception before re-raising it

2009-03-05 Thread Steven D'Aprano
d error message Note how the line numbers in the traceback are different. 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 -- http://mail.python.org/mailman/listinfo/python-list