0 follower

Final Class Yiisoft\Yii\Sentry\SentryMiddleware

InheritanceYiisoft\Yii\Sentry\SentryMiddleware
ImplementsPsr\Http\Server\MiddlewareInterface

Catches web application exceptions and forwards them to Sentry.

In order to catch all exceptions, add it right after ErrorCatcher in the main middleware set.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( \Sentry\State\HubInterface $hub )
$hub \Sentry\State\HubInterface

                public function __construct(private readonly HubInterface $hub)
{
}

            
process() public method

public \Psr\Http\Message\ResponseInterface process ( \Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Server\RequestHandlerInterface $handler )
$request \Psr\Http\Message\ServerRequestInterface
$handler \Psr\Http\Server\RequestHandlerInterface

                public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
    try {
        return $handler->handle($request);
    } catch (Throwable $e) {
        $this->hub->captureException($e);
        throw $e;
    }
}