forked from eatvio/eatvio-infra
refactor code-style rector and php-insight
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Sentry\Laravel\Integration;
|
||||
use Throwable;
|
||||
|
||||
@@ -35,6 +38,14 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->renderable(static function (Exception $exception, Request $request) {
|
||||
if ($exception instanceof \DomainException && $request->expectsJson()) {
|
||||
return response()->json([
|
||||
'message' => $exception->getMessage(),
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
});
|
||||
|
||||
$this->reportable(function (Throwable $e) {
|
||||
Integration::captureUnhandledException($e);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user