mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 00:01:21 +00:00
Handle 500 errors in production properly
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
@@ -44,7 +45,19 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
// 404 page when a model is not found
|
||||
if ($exception instanceof ModelNotFoundException) {
|
||||
return response()->view('errors.404', [], 404);
|
||||
}
|
||||
|
||||
if ($this->isHttpException($exception)) {
|
||||
return $this->renderHttpException($exception);
|
||||
}
|
||||
// Custom error 500 view on production
|
||||
if (app()->environment() === 'production') {
|
||||
return response()->view('errors.503', [], 500);
|
||||
}
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user