Looking at other systems than yours every now and then is great, as you can get some ideas. First such idea to come to Midgard from the Django world is error interceptors, a set of configurable actions to perform on given types of errors. For a long time, Midgard has been mapping various types of system errors (and in MidCOM3, Exceptions) to various HTTP status codes, and has made it possible to create customized templates for displaying them.
Error interceptors, on the other hand, allow other actions to take place. Some examples:
- Log all 404 Not Found page URLs into a special log file alongside their referrers
- Send all 500 Internal Errors with debug stacktrace to the site developer
$GLOBALS['midcom_config_local']['error_actions'] = array ( 500 => array ( 'action' => 'email', 'email' => 'firstname.lastname@example.org', ), 404 => array ( 'action' => 'log', 'filename' => '/var/log/broken_links.log', ), );