Merge pull request #1413 from machuga/develop
Add 500 response code to exception handler. -- machuga, JesseOBrien, sde...
This commit is contained in:
commit
5059ced2e1
|
@ -30,9 +30,10 @@ public static function exception($exception, $trace = true)
|
||||||
// If detailed errors are enabled, we'll just format the exception into
|
// 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
|
// 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.
|
// View in case the problem is in the View class.
|
||||||
|
|
||||||
if (Config::get('error.detail'))
|
if (Config::get('error.detail'))
|
||||||
{
|
{
|
||||||
echo "<html><h2>Unhandled Exception</h2>
|
$response_body = "<html><h2>Unhandled Exception</h2>
|
||||||
<h3>Message:</h3>
|
<h3>Message:</h3>
|
||||||
<pre>".$message."</pre>
|
<pre>".$message."</pre>
|
||||||
<h3>Location:</h3>
|
<h3>Location:</h3>
|
||||||
|
@ -40,10 +41,12 @@ public static function exception($exception, $trace = true)
|
||||||
|
|
||||||
if ($trace)
|
if ($trace)
|
||||||
{
|
{
|
||||||
echo "
|
$response_body .= "
|
||||||
<h3>Stack Trace:</h3>
|
<h3>Stack Trace:</h3>
|
||||||
<pre>".$exception->getTraceAsString()."</pre></html>";
|
<pre>".$exception->getTraceAsString()."</pre></html>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$response = Response::make($response_body, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're not using detailed error messages, we'll use the event
|
// 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');
|
$response = Event::first('500');
|
||||||
|
|
||||||
echo Response::prepare($response)->render();
|
$response = Response::prepare($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$response->render();
|
||||||
|
$response->send();
|
||||||
|
$response->foundation->finish();
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue