Lean code

This commit is contained in:
Sam Georges 2014-09-20 17:56:59 +10:00
parent c1d1ce49da
commit 45811dfb95
2 changed files with 4 additions and 9 deletions

View File

@ -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);
});
/*

View File

@ -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