diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php index bc6f09f..7bc795d 100644 --- a/src/Exceptions/Handler.php +++ b/src/Exceptions/Handler.php @@ -14,8 +14,7 @@ class Handler extends ExceptionHandler * * @var array */ - protected $dontReport = [ - ]; + protected $dontReport = []; /** * A list of the inputs that are never flashed for validation exceptions. @@ -98,6 +97,11 @@ public function render($request, \Throwable $exception) return response()->error($exception->getMessage()); } + // if exception has JSON response return it + if (isset($exception->response) && $exception->response instanceof \Illuminate\Http\Response) { + return $exception->response; + } + if (app()->environment(['development', 'local'])) { return parent::render($request, $exception); }