Registering a "Last Chance" Error Handler

Problem

You want to handle errors ONLY if nothing else handles them.

Solution

Use the App::pushError() method.

This will add your handler to the bottom of the stack instead of the top of the stack.

App::pushError(function($exception)
{
    die('ERROR: '.$exception->getMessage());
});

Discussion

This is exactly like App::error().

Except the handler is placed on the bottom of the stack instead of the top. See Registering an Error Handler.

comments powered by Disqus