Re: [Python-Dev] Adding content to exception messages

2005-05-29 Thread Nicolas Fleury
Nick Coghlan wrote: > With PEP 344, this could simply be: > >try: >parser.parseFile(file) >exeption Exception, exception: >raise type(exception)("Error at line %s in file %s" % (x,y)) > > Introspectively, > Nick. > It doesn't work (unless I misundertand you). For exampl

Re: [Python-Dev] Adding content to exception messages

2005-05-19 Thread Ka-Ping Yee
On Thu, 19 May 2005, Nick Coghlan wrote: > With PEP 344, this could simply be: > >try: >parser.parseFile(file) >exeption Exception, exception: >raise type(exception)("Error at line %s in file %s" % (x,y)) Only if we also made all exceptions new-style classes. That's just a

Re: [Python-Dev] Adding content to exception messages

2005-05-19 Thread Nick Coghlan
Nicolas Fleury wrote: > I do a lot of exception re-raising at work; I use that > technique to add content to exception messages while > keeping the original stack. I even created a reraise > function that I use that way: > > try: > parser.parseFile(file) > exeption Exception, exception: >

[Python-Dev] Adding content to exception messages

2005-05-18 Thread Nicolas Fleury
Sorry if this message is not a direct reply to Ka-Ping Yee message on PEP344, I'm in vacation in China and there's a thing I must say that could make sense in PEP344. I do a lot of exception re-raising at work; I use that technique to add content to exception messages while keeping the original s