[ZPT] Line numbers in errors

Richard Jones rjones@ekit-inc.com
Fri, 13 Sep 2002 08:25:56 +1000


On Fri, 13 Sep 2002 1:06 am, Shane Hathaway wrote:
> Richard Jones wrote:
> > I'd like to include the line number of an error when there's a run-time
> > error generated from an expression. I've had a poke through the source,
> > but couldn't see anything obvious. Is there any way of getting that
> > information into the expressions so I can pull it out in my exception
> > handler?
>
> If you're using the Zope CVS trunk, look at the ExceptionFormatter class
> in zExceptions.  It searches the stack frame objects for
> __traceback_supplement__ variables, and when it finds them, it inserts
> the information provided by the supplement into the traceback.  The
> PageTemplate code uses this method to show template filenames and line
> numbers.

Hrm, I'm using my own version of the traceback analysis, but I guess I just 
missed the information in the supplement that gave me the info. I'll have 
another look.


    Richard