Extensive error and exception catcher
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Ultimo - Error

Extensive error and exception catcher

Catches all exceptions and almost all errors. The main class is the result of years of experience with several high-traffic websites.


  • Able to handle uncaught errors, such fatals and memory errors.
  • Handles each error only once, to prevent flooding of for instance a notice within a loop.
  • Only handles errors specfied by error_reporting().
  • Increases the memory limit before handling an error. This prevents a memory error within the error handler.
  • Takes errors, fatals and exceptions within each handler function into account. Only fatal errors within fatal error handling are impossible to handle.
  • Has the same abilities to log and ignore repeated errors as the default error handling. Uses the php ini settings for this, but these may be overridden.
  • Two (sample) handlers are provided:
  • ErrorPrinter: Just prints errors
  • ErrorCarer: Mails errors


  • PHP 5.3


Register an ErrorHandler first, as anything may trigger errors or exceptions. You have to trust the ErrorHandler itself not to trigger errors though.

// require the ErrorHandler manually, as an autoloading mechanism may trigger errors

// register errorHandler (for fatals)
$errorHandler = new \ultimo\debug\error\ErrorPrinter();

// ... Start your script or application

// unregister errorHandler (to indicate there was no fatal)

// End of script or application