I modified it to handle errors as well and added some features which make it useful in productive systems as well: Error logging, Error Mailing, and Configuration.
The script logs or mails unique errors only once to prevent your log file or mailbox to be spammed with the same error again and again. It also takes care of the error level including shutup operator. It's a little bit hacky but did well on our dev servers (where errors tend to happen) in the past few weeks.
The link to grab this latest version of a handy bit of functionality is here - two different files, one for the error handler and one for the exception handler. He also includes a sample code snippet of how to use it.