# Exception handling

XR Debug provides a throwable handler can hook or replace your existing exception handler logic.


Check our ThrowableHandler (opens new window) package for more into exception & error handling for PHP software. The chevere/throwable-handler package is included with XR Debug.

# Register XR Debug handler

Use Chevere\Xr\registerThrowableHandler to enable XR Debug throwable handling.

use Chevere\Xr\registerThrowableHandler;

// True append XR Debug to your existing handler
// False use only XR Debug handler

# Triggered handler

Use Chevere\Xr\throwableHandler in any existing exception handler logic:

use Chevere\Xr\throwableHandler;

    function(Throwable $throwable) {
        // ...
        try {
        } catch(Throwable) {
            // Don't panic