The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Continue after Error Handler Notice

Justin Kelley's Avatar

Justin Kelley

17 Mar, 2016 05:51 PM

I'm working on handling native php errors using Slim 3's error handling in conjunction with Monolog. I set up an error handler that converts Errors into Error Exceptions and then throws them over to Slim. I want to log everything, including notices and deprecation. The problem is that execution halts after the error is thrown.

I know $container['errorHandler'] needs to return a valid response object, but I want it to continue execution in the event of a NOTICE. Any suggestions on how to handle this? Here is a sample of the code:

return function ($request, $response, $e) use ($c) {
        switch ($e->getCode()) {
            case 8:
            case 1024:
            case 2048:
            case 8192:
            case 16384:
                return $response->withStatus(200);
            case 32:
            case 512:
                return $c['response']->withStatus(500)->withHeader('Content-Type', 'text/html')->write('Something went wrong!');
                return $c['response']->withStatus(400)->withHeader('Content-Type', 'text/html')->write('Something went wrong!');

Thank you!

  1. 1 Posted by propertyrudra12 on 20 Mar, 2016 07:45 AM

    propertyrudra12's Avatar

    Fantastic article post.Really looking forward to read more. Awesome.
    Hotels in SHimla @

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


? 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