From 24ba947d10ef77accfebf7843b7081e303ac1ca3 Mon Sep 17 00:00:00 2001 From: Matthew Machuga Date: Fri, 2 Nov 2012 21:57:41 -0400 Subject: [PATCH] Add 500 response code to exception handler. -- machuga, JesseOBrien, sdeinum --- laravel/error.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) 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 +}