Exception Handling In DTML - Endzone (
Page 10 of 10 )
And that just about covers it. In this article, I took you on a guided tour of exception handling in DTML, demonstrating how the
and
blocks can be used to trap and resolve errors in script execution. I showed you how the
statement could be used to handle different exceptions differently, or be set up to catch all errors in a generic manner.
I also explained a variant, the <dtml-finally> statement, and demonstrated how it could be nested within a set of <dtml-try> blocks to trigger specific code segments whenever an exception occurs. Finally, I showed you how to create your own custom exceptions via <dtml-raise>, and provided you with a quick look at some of the built-in exceptions that come with Zope.
In case you'd like to learn more about these topics, you should consider visiting the following links:
Exception handling in Zope, at
http://www.zope.org/Documentation/ZopeBook/AdvDTML.stx Reference material for the various exception handling tags, at
http://www.zope.org/Documentation/ZopeBook/AppendixA.stx A complete list of Python exceptions, at
http://www.python.org/doc/current/lib/module-exceptions.html Until next time...be good!
Note: All examples in this article have been tested on Linux/i586 with Zope 2.5.0. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!