Browse Source

fixed:异常处理

刘学玺 4 months ago
parent
commit
2457013b63
1 changed files with 5 additions and 5 deletions
  1. 5 5
      app/Exceptions/Handler.php

+ 5 - 5
app/Exceptions/Handler.php

@@ -3,16 +3,16 @@
 namespace App\Exceptions;
 
 use Exception;
+use Throwable;
+use Illuminate\Support\Facades\Log;
 use Illuminate\Auth\AuthenticationException;
-use Illuminate\Database\Eloquent\ModelNotFoundException;
-use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Session\TokenMismatchException;
-use Illuminate\Support\Facades\Log;
 use Illuminate\Validation\ValidationException;
 use Symfony\Component\HttpFoundation\Response;
+use Illuminate\Database\Eloquent\ModelNotFoundException;
 use Symfony\Component\HttpKernel\Exception\HttpException;
+use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use Throwable;
 
 class Handler extends ExceptionHandler
 {
@@ -96,7 +96,7 @@ class Handler extends ExceptionHandler
 
         // 验证异常
         $this->renderable(function (ValidationException $e) {
-            return $this->formatJsonResponse(422, $e->validator->errors()->first(), Response::HTTP_UNPROCESSABLE_ENTITY);
+            return $this->formatJsonResponse(200, $e->validator->errors()->first(), Response::HTTP_UNPROCESSABLE_ENTITY);
         });
 
         // HTTP异常