Programming
Article
By Maarten Manders

Pimpin Harry’s pretty bluescreen

By Maarten Manders

Proper error and exception display can save you a lot af time and nerves. A few months ago, Harry published a slick bluescreen script for exception handling. 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
  • 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.

To use it, download and include the two files and then setup the error and exception handler in your PHP script:

 
  
set_exception_handler(array('ErrorHandler', 'handleException'));
set_error_handler(array('ErrorHandler', 'handleError'));
 
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account