Fixed weird status code error on ajax

This commit is contained in:
snipe 2017-01-24 18:56:15 -08:00
parent b019e6e950
commit 8f0ab1e719

View file

@ -63,9 +63,11 @@ class Handler extends ExceptionHandler
if ($this->isHttpException($e)) { if ($this->isHttpException($e)) {
$statusCode = $e->getStatusCode();
switch ($e->getStatusCode()) { switch ($e->getStatusCode()) {
case '404': case '404':
return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' not found'), 404); return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' endpoint not found'), 404);
break; break;
case '405': case '405':
return response()->json(Helper::formatStandardApiResponse('error', null, 'Method not allowed'), 405); return response()->json(Helper::formatStandardApiResponse('error', null, 'Method not allowed'), 405);
@ -79,17 +81,10 @@ class Handler extends ExceptionHandler
} }
if ($this->isHttpException($e)) { if ($this->isHttpException($e) && (isset($statusCode)) && ($statusCode == '404' )) {
return response()->view('layouts/basic', [
$statusCode = $e->getStatusCode(); 'content' => view('errors/404')
]);
switch ($statusCode) {
case '404':
return response()->view('layouts/basic', [
'content' => view('errors/404')
]);
}
} }
return parent::render($request, $e); return parent::render($request, $e);