The web.error module provides enhanced functionality based on the cgitb module distributed with Python. If an exception is raised in the code the web.error module will catch the error and produce a customised display of the error, the surrounding code and the values of variables in the line which caused the error. It also provides the ability to email error reports or log them to a file.
Using the module you can also provide your own error handling. The example at the end shows you how to log all errors to a database.