浏览代码

fixed:异常处理

刘学玺 4 月之前
父节点
当前提交
24aa16ece0
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/Exceptions/Handler.php

+ 2 - 2
app/Exceptions/Handler.php

@@ -96,12 +96,12 @@ class Handler extends ExceptionHandler
 
         // 验证异常
         $this->renderable(function (ValidationException $e) {
-            return $this->formatJsonResponse(200, $e->validator->errors()->first(), Response::HTTP_UNPROCESSABLE_ENTITY);
+            return $this->formatJsonResponse(Response::HTTP_UNPROCESSABLE_ENTITY, $e->validator->errors()->first(), 200);
         });
 
         // HTTP异常
         $this->renderable(function (HttpException $e) {
-            return $this->formatJsonResponse(200, $e->getMessage(), $e->getStatusCode());
+            return $this->formatJsonResponse($e->getStatusCode(), $e->getMessage(), 200);
         });
 
         // 业务异常