Skip to content

Commit

Permalink
Merge pull request #3285 from nanaya/json_return
Browse files Browse the repository at this point in the history
Return json on error for a json request
  • Loading branch information
peppy committed May 30, 2018
2 parents 2849284 + 76eb16c commit afdd808
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Expand Up @@ -108,7 +108,7 @@ public function render($request, Exception $e)
} else {
$message = $this->exceptionMessage($e);

if ($request->ajax()) {
if ($request->expectsJson()) {
$response = response(['error' => $message]);
} else {
$response = response()->view('layout.error', ['exceptionMessage' => $message]);
Expand Down

0 comments on commit afdd808

Please sign in to comment.