12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Hyperf.
- *
- * @link https://www.hyperf.io
- * @document https://hyperf.wiki
- * @contact group@hyperf.io
- * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
- */
- namespace Hyperf\JsonRpc\Exception\Handler;
- use Hyperf\Contract\StdoutLoggerInterface;
- use Hyperf\ExceptionHandler\ExceptionHandler;
- use Hyperf\ExceptionHandler\Formatter\FormatterInterface;
- use Psr\Http\Message\ResponseInterface;
- use Throwable;
- class TcpExceptionHandler extends ExceptionHandler
- {
- public function __construct(protected StdoutLoggerInterface $logger, protected FormatterInterface $formatter)
- {
- }
- public function handle(Throwable $throwable, ResponseInterface $response)
- {
- $this->logger->warning($this->formatter->format($throwable));
- $this->stopPropagation();
- return $response;
- }
- public function isValid(Throwable $throwable): bool
- {
- return true;
- }
- }
|