Re: Changing page-level error handler
Iwan Vosloo <[email protected]> Mon, 25 Dec 2006 10:16:29 +0200
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Jonathan, Philip, On Fri, 2006-12-22 at 07:01 -0800, Jonathan Ellis wrote: > On Fri, 22 Dec 2006 11:57:10 +0200, "Iwan Vosloo" <[email protected]> said: > > But my understanding is that the server-level error handler will not be > > called for, say spyce compilation errors or exceptions in python code > > called from a spyce template. Am I understanding correctly? > > I don't think so... There may be some compile errors that don't, but > the majority do... Python errors will be re-raised as > spyceRuntimeException. Sorry, but I still don't get it - it does not seem that the server-level error handler is called for Python exceptions. Here's my test... I have copied the spyceconf.py as shipped and just changed the following: #import error #errorhandler = error.serverHandler def reraisingHandler(theServer, theRequest, theResponse, theError): raise theError errorhandler = reraisingHandler I then run spyceCmd.py --conf that_changed_spyceconf.py afile.spy afile.spy just has a line: [[ raise 'some error' ]] But it still returns an html page, instead of just raising the exception: <html> <title>Spyce exception: some error </title> <body> <table cellspacing=10 border=0> <tr><td colspan=2><h1>Spyce exception</h1></td></tr> <tr><td valign=top align=right><b>File:</b></td><td>/home/iwan/work/play.d/spyce/exc/afile.spy</tr> <tr><td valign=top align=right><b>Message:</b></td> <td><pre>some error </pre></tr> <tr><td valign=top align=right><b>Stack:</b></td><td> afile.spy:2, in (main):<br> <table border=0><tr><td width=10></td><td> <pre>raise 'some error'</pre> </td></tr></table> </td></tr> </table> </body></html> ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV