[Zope3-dev] Better exception display
Richard Jones
rjones@ekit-inc.com
Wed, 22 Jan 2003 10:51:26 +1100
--Boundary-00=_+zdL+4y6/6jyTOT
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Wed, 22 Jan 2003 10:35 am, holger krekel wrote:
> When i am developing Zope2 stuff i often get long tracebacks when
> trying to perform a certain action TTW. I might not even have changed
> the code but did a 'cvs up'. So here is my application with all
> the ZPT-rendering, macros and application level stuff going on.
> And a traceback with 20 entries. where the last problems took
> place in some ZPT which was invoked through a script through other
> ZPTs. No doubt, someone more knowledgable (and knowing the app)
> might rather quickly deduce where the problem actually is.
>
> I am just saying that a different representation of Exceptions
> would probably not help me too much. Unless Shane is right
> and the Zope2.6 error handling already offers enough
> improvement for such situations.
I did a lot of work in Roundup - which uses ZPT - in cleaning up the
tracebacks for exceptions in template rendering. There's usually a lot of
info jammed away in the stack for the traceback display to use (and I
actually stuff some extra namespace/expression info away in addition to the
normal ZPT info). Attached is an example of a simple templating exception.
Richard
--Boundary-00=_+zdL+4y6/6jyTOT
Content-Type: text/html;
charset="iso-8859-1";
name="sample.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="sample.html"
<h1>Templating Error</h1>
<p><b>exceptions.AttributeError</b>: StringHTMLProperty instance has no attribute 'plain2'</p>
<p class="help">Debugging information follows</p>
<ol>
<li>In python expression "msg.content.plain2(hyperlink=1)"</li>
<li>While evaluating the <PythonExpr msg.content.plain2(hyperlink=1)> expression on line 143
<table class="otherinfo" style="font-size: 90%">
<tr><th colspan="2" class="header">Current variables:</th></tr>
<tr><td><strong>templates</strong></td><td><roundup.cgi.templating.Templates instance at 0x838f2fc></td></tr>
<tr><td><strong>repeat</strong></td><td><roundup.cgi.PageTemplates.TALES.SafeMapping instance at 0x83a8f64></td></tr>
<tr><td><strong>default</strong></td><td><roundup.cgi.PageTemplates.TALES.Default instance at 0x832c7fc></td></tr>
<tr><td><strong>db</strong></td><td><roundup.cgi.templating.HTMLDatabase instance at 0x83a99f4></td></tr>
<tr><td><strong>utils</strong></td><td><roundup.cgi.templating.utils instance at 0x835ed64></td></tr>
<tr><td><strong>request</strong></td><td><roundup.cgi.templating.HTMLRequest instance at 0x83a335c></td></tr>
<tr><td><strong>tracker</strong></td><td><module '_roundup_tracker_1' from '/tmp/test/__init__.pyc'></td></tr>
<tr><td><strong>context</strong></td><td><HTMLItem(0x83a8a84) issue 1></td></tr>
<tr><td><strong>nothing</strong></td><td>None</td></tr>
<tr><td><strong>config</strong></td><td><module '_roundup_tracker_1.config' from '/tmp/test/config.pyc'></td></tr>
<tr><td><strong>options</strong></td><td>{'ok_message': [], 'error_message': []}</td></tr>
<tr><td><strong>loop</strong></td><td><roundup.cgi.PageTemplates.TALES.SafeMapping instance at 0x83a8f64></td></tr>
<tr><td><strong>msg</strong></td><td><HTMLItem(0x83b31d4) msg 2></td></tr>
<tr><td><strong>attrs</strong></td><td>{'tal:content': 'structure python:msg.content.plain2(hyperlink=1)'}</td></tr>
</table></li>
<li>A problem occurred in your template "issue.item".</li>
</ol>
<table style="font-size: 80%; color: gray">
<tr><th class="header" align="left">Full traceback:</th></tr>
<tr><td><pre>Traceback (most recent call last):
File "/home/rjones/src/roundup/roundup/roundup/cgi/client.py", line 378, in renderContext
return pt.render(self, None, None, **args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/templating.py", line 187, in render
getEngine().getContext(c), output, tal=1, strictinsert=0)()
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 154, in __call__
self.interpret(self.program)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 525, in do_useMacro
self.interpret(macro)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 549, in do_defineSlot
self.interpret(slot)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 491, in do_condition
self.interpret(block)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 345, in do_optTag_tal
self.do_optTag(stuff)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 330, in do_optTag
return self.no_tag(start, program)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 325, in no_tag
self.interpret(program)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 491, in do_condition
self.interpret(block)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 476, in do_loop_tal
self.interpret(block)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 345, in do_optTag_tal
self.do_optTag(stuff)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 330, in do_optTag
return self.no_tag(start, program)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 325, in no_tag
self.interpret(program)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 186, in interpret
handlers[opcode](self, args)
File "/home/rjones/src/roundup/roundup/roundup/cgi/TAL/TALInterpreter.py", line 432, in do_insertStructure_tal
structure = self.engine.evaluateStructure(expr)
File "/home/rjones/src/roundup/roundup/roundup/cgi/PageTemplates/TALES.py", line 225, in evaluate
v = expression(self)
File "/home/rjones/src/roundup/roundup/roundup/cgi/PageTemplates/PythonExpr.py", line 71, in __call__
return f()
File "<string>", line 2, in f
AttributeError: StringHTMLProperty instance has no attribute 'plain2'
</pre></td></tr>
</table>
<p> </p>
--Boundary-00=_+zdL+4y6/6jyTOT--