正在显示
1 个修改的文件
包含
4 行增加
和
5 行删除
| @@ -111,6 +111,10 @@ class Handler extends ExceptionHandler | @@ -111,6 +111,10 @@ class Handler extends ExceptionHandler | ||
| 111 | $code = $exception->getCode(); | 111 | $code = $exception->getCode(); |
| 112 | }elseif ($exception instanceof BsideGlobalException) { | 112 | }elseif ($exception instanceof BsideGlobalException) { |
| 113 | $code = $exception->getCode(); | 113 | $code = $exception->getCode(); |
| 114 | + } elseif ($exception instanceof ValidationException) { | ||
| 115 | +// $code = Code::USER_PARAMS_ERROE(); | ||
| 116 | + $code = $exception->getCode(); | ||
| 117 | + $message = Arr::first(Arr::first($exception->errors())); | ||
| 114 | } elseif ($exception instanceof NotFoundHttpException || $exception instanceof MethodNotAllowedHttpException) { | 118 | } elseif ($exception instanceof NotFoundHttpException || $exception instanceof MethodNotAllowedHttpException) { |
| 115 | return response('404 Not Found', 404); | 119 | return response('404 Not Found', 404); |
| 116 | } else { | 120 | } else { |
| @@ -129,11 +133,6 @@ class Handler extends ExceptionHandler | @@ -129,11 +133,6 @@ class Handler extends ExceptionHandler | ||
| 129 | $debub = config('app.debug'); | 133 | $debub = config('app.debug'); |
| 130 | $message = $debub ? $message : ($code->description ?? $message); | 134 | $message = $debub ? $message : ($code->description ?? $message); |
| 131 | 135 | ||
| 132 | - //请求参数错误 输出具体错误信息 | ||
| 133 | - if($code == Code::USER_PARAMS_ERROE()){ | ||
| 134 | - $message = Arr::first(Arr::first($exception->errors())); | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | $response = [ | 136 | $response = [ |
| 138 | 'code' => $code, | 137 | 'code' => $code, |
| 139 | 'message' => $message | 138 | 'message' => $message |
-
请 注册 或 登录 后发表评论