Re: Re: Help catching an exception...
Tim Churches <[email protected]> Thu, 30 Sep 2004 11:50:09 +1000
| Newsgroups | gmane.comp.web.albatross.general |
|---|---|
| Message-ID | <[email protected]> |
In one of the Albatross apps which Andrew has been working on for us, he has arranged things so that exceptions are caught and the user is presented with a nice explanatory page telling them something has gone wrong and inviting them to log back in (the user's credentials are invalided by the exception handling routine for security reasons). A copy of the traceback is emailed to the system administrator. We have found this to be very useful. Even better would be writing details of the app context as well as teh traceback into an app exceptions log, along with any other relevent details or clues about what the user was doing at the time (maybe the user could be presented with a page inviting them to describe what they were doing at the time). Since this information may include confidential or security-sensitive details, it should not be emailed, but a tickler message might still be emailed to the system admin alerting them that an exception has occured. Andrew: want to put these ideas on the To-Do list for the NetEpi apps? Tim C > Andrew McNamara <[email protected]> wrote: > >In the testing process, I have determined that certain type of request urls >will cause Albatross to throw an exception, and I'm trying to catch that >exception to redirect to a public error page of my choosing so that end >users do not see the Python tracebacks. There are several ways to do this. As Neal suggested, you can subclass the Application class you have chosen, and override the handle_exception method, or you can add a template page called "traceback.html", which will be passed the python and albatross template tracebacks (with special characters suitably escaped) in python_exc and html_exc respectively. I would also recommend looking at the Albatross code - specifically the Application class in app.py. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ _______________________________________________ Albatross-users mailing list [email protected] https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users