Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79965

Re: When using a decorator exceptions raised reference the decorator not the function

From Terry Reedy <tjreedy@udel.edu>
Subject Re: When using a decorator exceptions raised reference the decorator not the function
Date 2014-10-30 14:06 -0400
References <CALyLaQJxfX_3aeACPjjkfzOKx+5K=uG9_PJZVFAfiUbL2t=ekw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15331.1414692605.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 10/30/2014 8:33 AM, Néstor Boscán wrote:

> I'm using Python 2.7 and I'm creating a class decorator that extract
> information from exceptions for logging purposes.
>
> Everytime an exception is raised from the original function and I
> extract the origin of the exception with sys.exc_info() I get a
> reference to the line in the decorator where the function is called, not
> the line of the original function where the exception was raised.

I expect that both lines should be in the traceback.  Post an example 
where you do not intercept the exception.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: When using a decorator exceptions raised reference the decorator not the function Terry Reedy <tjreedy@udel.edu> - 2014-10-30 14:06 -0400

csiph-web