The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Slim Framework 3 - Errors and FatalErrors handled as Slim Exception

xMolchy's Avatar

xMolchy

13 Oct, 2015 07:24 AM

Hi,

Trying to handle all Errors by Slim ErrorHandler but Fatal errors are making issues for me ... Trying to do the
same as handleErrors with handleFatalErrors i get Uncaught Exception - Exception ... then i define Exception Handler and
throw Exception there ... still nothing :(

Any ideas how i can handle fatal errors with slim error handler ?

class ErrorHandler
{

    public static function register()
    {
        set_error_handler( [
            __CLASS__,
            'handleErrors'
        ] );
        register_shutdown_function([__CLASS__, 'handleFatalErrors']);
    }

    // Errors as Exception so we can handle them same for Output, Logging ...
    public static function handleErrors( $code, $message, $file = '', $line = 0 )
    {
        throw new RuntimeException( $message, $code );
    }
}

Tnx you for your time and assistance ...

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac