wip
This commit is contained in:
@@ -56,17 +56,17 @@ class ExceptionHandle extends Handle
|
||||
{
|
||||
// 验证器异常
|
||||
if ($e instanceof ValidateException) {
|
||||
return $this->error(422, $e->getError()); // 验证器没通过
|
||||
return $this->error($e->getError(), [], 422); // 验证器没通过
|
||||
};
|
||||
|
||||
// 请求异常
|
||||
if ($e instanceof HttpException) {
|
||||
return $this->error($e->getStatusCode(), $e->getMessage());
|
||||
return $this->error($e->getMessage(), [], $e->getStatusCode());
|
||||
};
|
||||
|
||||
// 处理【自定义业务异常】(在 Service 层主动 throw 的错误)
|
||||
if ($e instanceof \think\Exception) {
|
||||
return $this->error($e->getCode() ?: 400, $e->getMessage());
|
||||
return $this->error($e->getMessage(), [], $e->getCode() ?: 400);
|
||||
}
|
||||
|
||||
// 其他错误交给系统处理
|
||||
|
||||
Reference in New Issue
Block a user