logger->error()->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile())); $this->logger->error()->error($throwable->getTraceAsString()); $throwable = $this->modifyException($throwable); return $this->handlerResponse($throwable,$response); } /** * @param Throwable $throwable * @return ErrException */ protected function modifyException(Throwable $throwable): ErrException { $this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile())); $this->logger->error($throwable->getTraceAsString()); // return $response->withHeader('Server', 'Hyperf')->withStatus(500)->withBody(new SwooleStream('Internal Server Error.')); return New ErrException(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()),ResultCode::ERROR); } /** * @param Throwable $throwable * @return bool */ public function isValid(Throwable $throwable): bool { return true; } }