Final Class Yiisoft\Yii\Sentry\SentryMiddleware
| Inheritance | Yiisoft\Yii\Sentry\SentryMiddleware |
|---|---|
| Implements | Psr\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.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Yii\Sentry\SentryMiddleware | |
| process() | Yiisoft\Yii\Sentry\SentryMiddleware |
Method Details
| public mixed __construct ( \Sentry\State\HubInterface $hub ) | ||
| $hub | \Sentry\State\HubInterface | |
public function __construct(private readonly HubInterface $hub)
{
}
| 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;
}
}
Signup or Login in order to comment.