up.
This commit is contained in:
parent
c5ccc91586
commit
749bb51dcd
@ -51,6 +51,12 @@ class ExceptionHandle extends Handle
|
||||
public function render($request, Throwable $e): Response
|
||||
{
|
||||
// 添加自定义异常处理机制
|
||||
if ($e instanceof ValidateException) {
|
||||
return json(['code'=>400,'message'=>$e->getMessage()]);
|
||||
}
|
||||
if ($request->isJson()) {
|
||||
return json(['code'=>400,'message'=>$e->getMessage()]);
|
||||
}
|
||||
|
||||
// 其他错误交给系统处理
|
||||
return parent::render($request, $e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user