Tinywan / webman-exception

exception handler library for webman plugin
https://www.workerman.net/webman
MIT License
15 stars 6 forks source link

按文档无法正确得到预期异常: BadRequestHttpException, MethodNotAllowedException #14

Open liuqingliu opened 8 months ago

liuqingliu commented 8 months ago

如题.版本 krisss/docker-webman:8.0-cli-alpine 需要按文档重写handler方法 protected function solveAllException(Throwable $e) { if ($e instanceof BaseException) { $this->statusCode = $e->statusCode; $this->header = $e->header; $this->errorCode = $e->errorCode; $this->errorMessage = $e->errorMessage; $this->error = $e->error; if (isset($e->data)) { $this->responseData = array_merge($this->responseData, $e->data); } return ; // 在这里直接返回,否则会被下面的方法接管结果.导致500,Internal Server Error } $this->solveExtraException($e); }

Tinywan commented 8 months ago

验证器是抛出验证器异常ValidateException