diff --git a/laravel/error.php b/laravel/error.php index a53d2e0b..283e043f 100644 --- a/laravel/error.php +++ b/laravel/error.php @@ -30,20 +30,23 @@ public static function exception($exception, $trace = true) // If detailed errors are enabled, we'll just format the exception into // a simple error message and display it on the screen. We don't use a // View in case the problem is in the View class. + if (Config::get('error.detail')) { - echo "

Unhandled Exception

-

Message:

-
".$message."
-

Location:

-
".$file." on line ".$exception->getLine()."
"; + $response_body = "

Unhandled Exception

+

Message:

+
".$message."
+

Location:

+
".$file." on line ".$exception->getLine()."
"; if ($trace) { - echo " + $response_body .= "

Stack Trace:

".$exception->getTraceAsString()."
"; } + + $response = Response::make($response_body, 500); } // If we're not using detailed error messages, we'll use the event @@ -53,9 +56,13 @@ public static function exception($exception, $trace = true) { $response = Event::first('500'); - echo Response::prepare($response)->render(); + $response = Response::prepare($response); } + $response->render(); + $response->send(); + $response->foundation->finish(); + exit(1); } @@ -119,4 +126,4 @@ public static function log($exception) } } -} \ No newline at end of file +}