Skip to content

Instantly share code, notes, and snippets.

@osibg
Created June 16, 2020 06:04
Show Gist options
  • Save osibg/efff19da03903352ee7206d635cf82d4 to your computer and use it in GitHub Desktop.
Save osibg/efff19da03903352ee7206d635cf82d4 to your computer and use it in GitHub Desktop.
Laravel default Exception Handler
<?php
namespace App\Exceptions;
class Handler extends \Laravel\Lumen\Exceptions\Handler
{
public function render($request, Throwable $exception)
{
if ($exception instanceof CustomException) {
return response()->json(['error' => 'Oops!'], 400);
}
return parent::render($request, $exception);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment