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. Josh Lockhart closed this discussion on 12 Feb, 2021 07:37 PM.

Comments are currently closed for this discussion. You can start a new one.

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