From 45811dfb958d1a31c4ec3be14ac93e47e5b0ac3e Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Sat, 20 Sep 2014 17:56:59 +1000 Subject: [PATCH] Lean code --- modules/system/ServiceProvider.php | 3 +-- modules/system/classes/ErrorHandler.php | 10 +++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/modules/system/ServiceProvider.php b/modules/system/ServiceProvider.php index d03a6edf5..7a3695360 100644 --- a/modules/system/ServiceProvider.php +++ b/modules/system/ServiceProvider.php @@ -71,8 +71,7 @@ class ServiceProvider extends ModuleServiceProvider */ App::error(function(\Exception $exception, $httpCode){ $handler = new ErrorHandler; - $isConsole = App::runningInConsole(); - return $handler->handleException($exception, $httpCode, $isConsole); + return $handler->handleException($exception, $httpCode); }); /* diff --git a/modules/system/classes/ErrorHandler.php b/modules/system/classes/ErrorHandler.php index 5ac0e82c8..29334ca82 100644 --- a/modules/system/classes/ErrorHandler.php +++ b/modules/system/classes/ErrorHandler.php @@ -37,14 +37,10 @@ class ErrorHandler * @param Exception $proposedException The exception candidate that has been thrown. * @return View Object containing the error page. */ - public function handleException(\Exception $proposedException, $httpCode = 500, $isCli = false) + public function handleException(\Exception $proposedException, $httpCode = 500) { - // Disable the error handler for CLI environment - if ($isCli) - return; - - // Disable the error handler for test environment - if (Config::getEnvironment() == 'testing') + // Disable the error handler for test and CLI environment + if (App::runningUnitTests() || App::runningInConsole()) return; // Detect AJAX request and use error 500