Re: Changing page-level error handler

Philip Semanchuk <[email protected]> Thu, 21 Dec 2006 14:34:25 -0500
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
On Dec 21, 2006, at 12:54 AM, Iwan Vosloo wrote:

> Hi Philip,
>
> On Wed, 2006-12-20 at 10:35 -0500, Philip Semanchuk wrote:
>> On Dec 20, 2006, at 7:57 AM, Iwan Vosloo wrote:
>> Hi Ivan,
>> In my spyceconf.py, I have this comment --
>>
>> # The pageerror option sets the default page-level error handler.
>> # "Page-level" means all runtime errors that occur during the
>> # processing of a Spyce script (i.e. after the compilation phase has
>> # completed successfully)
>> #
>> # The format of this option is one of:
>> #   ('string', 'MODULE', 'VARIABLE')
>> #   ('file', 'URL')
>> # (This format is used since the error template must be transformed 
>> into
>> # compiled spyce code, which can't be done before the configuration 
>> file
>> # is completely loaded.)
>> #
>> # Please refer to the default template to see how to define your own
>> # page-level error handlers.
>>
>>
>> And this bit of code works for me:
>> pageerrortemplate = ('string', 'TheModuleName', 'TheFunctionName')
>>
>
> Yes, that comment (except for the very first line, which refers to
> "pageerror") applies to "pageerrortemplate" - as you use it.
>
> My (probably erroneous) understanding from what I've read is that there
> is an error handling _function_ also, and that the default one renders
> "pageerrortemplate".
>
> But I don't want it to render any templates at all, I want it just to
> call my own function...  I call spyce programmatically from another
> program, and would rather catch an exception myself, rather than have
> spyce render an error page.  This is the behaviour I'm trying to
> change...

Iwan,
I also call Spyce programmatically in addition to using it to serve up 
dynamic Web pages, so I appreciate where you're coming from. However, I 
don't actually get what you're trying to do. Are you saying that some 
of your errors are recoverable and that you'd like to ignore them and 
have Spyce continue processing?

My code for handling errors generated programmatically gets some detail 
about the error, records that data and then dumps processing to an 
"oops.html" file which basically says "Sorry, something went wrong". I 
understand that you don't want the output page, so couldn't you just 
use the same technique to execute whatever code you want and make 
oops.html a zero-byte file?

Sorry that I'm not getting it! =)  Maybe a high level example of what 
you'd like to be able to do would help.

bye
Philip


-------------------------------------------------------------------------
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