error changes

This commit is contained in:
rahul shukla 2018-10-25 14:36:51 +05:30
parent af5b9d9f06
commit 84ba1d4fc6
2 changed files with 27 additions and 13 deletions

View File

@ -22,30 +22,44 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $exception)
{
if ($exception instanceof HttpException) {
$statusCode = $exception->getStatusCode();
if (strpos($_SERVER['REQUEST_URI'], 'admin') !== false) {
return response(view('admin::errors.'.$statusCode, [
'msg' => $exception->getMessage(),
'code' => $statusCode
]), $statusCode);
switch ($statusCode) {
case 404:
return response()->view('admin::errors.404', [], 404);
break;
case 403:
return response()->view('admin::errors.403', [], 403);
break;
case 401:
return response()->view('admin::errors.401', [], 401);
break;
default:
return response()->view('admin::errors.500', [], 500);
}
} else {
return response(view('shop::errors.'.$statusCode, [
'msg' => $exception->getMessage(),
'code' => $statusCode
]), $statusCode);
switch ($statusCode) {
case 404:
return response()->view('shop::errors.404', [], 404);
break;
case 403:
return response()->view('shop::errors.403', [], 403);
break;
case 401:
return response()->view('shop::errors.401', [], 401);
break;
default:
return response()->view('shop::errors.500', [], 500);
}
}
} else if ($exception instanceof ModelNotFoundException) {
if (strpos($_SERVER['REQUEST_URI'], 'admin') !== false){
return response()->view('admin::errors.404', [], 404);
}else {
return response()->view('shop::errors.404', [], 404);
}
} else if ($exception instanceof PDOException) {
if (strpos($_SERVER['REQUEST_URI'], 'admin') !== false){
return response()->view('admin::errors.500', [], 500);
} else {

View File

@ -462,7 +462,7 @@ return [
'go-to-home' => 'GO TO HOME',
'404' => [
'page-title' => 'Page not found',
'page-title' => '404 Page not found',
'name' => '404',
'title' => 'Page Not found',
'message' => 'The Page you are looking for doesnt exist or have secrately escaped;head back to home and make a fresh move again.'