From 821511e4a1fef4c462ce3a8b929b574ab0fdc5d6 Mon Sep 17 00:00:00 2001 From: Rob Allen Date: Sat, 5 Sep 2015 17:47:13 +0100 Subject: [PATCH] Don't call errorHandler if we don't have one If the errorHandler has been unregistered, then just throw the Exception again. This allows for completely disabling our error handling by doing: unset($app->getContainer()['errorHandler']); --- Slim/App.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Slim/App.php b/Slim/App.php index 02641ef91..62ec43e8c 100644 --- a/Slim/App.php +++ b/Slim/App.php @@ -309,6 +309,9 @@ public function run($silent = false) } catch (SlimException $e) { $response = $e->getResponse(); } catch (Exception $e) { + if (!$this->container->has('errorHandler')) { + throw $e; + } /** @var callable $errorHandler */ $errorHandler = $this->container->get('errorHandler'); $response = $errorHandler($request, $response, $e);