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


Groups > comp.lang.python > #79965 > unrolled thread

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

Started byTerry Reedy <tjreedy@udel.edu>
First post2014-10-30 14:06 -0400
Last post2014-10-30 14:06 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromTerry Reedy <tjreedy@udel.edu>
Date2014-10-30 14:06 -0400
SubjectRe: When using a decorator exceptions raised reference the decorator not the function
Message-ID<mailman.15331.1414692605.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web