$throwable->getCode(), 'message' => $throwable->getMessage(), ], JSON_UNESCAPED_UNICODE); // 阻止异常冒泡 $this->stopPropagation(); return $response->withAddedHeader('content-type', 'application/json; charset=utf-8')->withStatus(200)->withBody(new SwooleStream($data)); } public function isValid(Throwable $throwable): bool { return $throwable instanceof BaseException; } }