diff --git a/api/app/Exceptions/Handler.php b/api/app/Exceptions/Handler.php index 8e7fbd1..a18882a 100644 --- a/api/app/Exceptions/Handler.php +++ b/api/app/Exceptions/Handler.php @@ -3,6 +3,7 @@ namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Illuminate\Validation\ValidationException; use Throwable; class Handler extends ExceptionHandler @@ -37,5 +38,8 @@ class Handler extends ExceptionHandler $this->reportable(function (Throwable $e) { // }); + $this->renderable(function (ValidationException $e) { + return send_error($e->errors()[array_key_first($e->errors())][0] ?? $e->getMessage(), ErrorCode('ARGS')); + }); } }