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


Groups > comp.lang.python > #79976

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

References <CALyLaQJxfX_3aeACPjjkfzOKx+5K=uG9_PJZVFAfiUbL2t=ekw@mail.gmail.com> <m2tuna$csq$2@ger.gmane.org>
From Néstor Boscán <nestor.boscan@tcs.com.ve>
Date 2014-10-30 16:42 -0430
Subject Re: When using a decorator exceptions raised reference the decorator not the function
Newsgroups comp.lang.python
Message-ID <mailman.15333.1414707564.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Thanks Terry

Yes both lines where in the traceback using tb_next I got what I needed.

Regards,

Néstor

On Thu, Oct 30, 2014 at 1:36 PM, Terry Reedy <tjreedy@udel.edu> wrote:

> 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
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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 Néstor Boscán <nestor.boscan@tcs.com.ve> - 2014-10-30 16:42 -0430

csiph-web