final class ApiExceptionResponseResolver implements ExceptionResponseResolverInterface (View source)

Converts failures for registered API endpoints into safe Problem Details responses.

Requests outside the API registry remain unclaimed for another HTTP resolver.

Methods

Binds exception classification to canonical endpoint matching and problem response creation.

ResponseInterface|null
resolve(Throwable $exception, ServerRequestInterface $request)

Returns a 404 for routing failures, a generic 500 for other API failures, or null outside the API.

ResponseInterface|null

Details

__construct

__construct(ApiEndpointRequestResolver $endpointResolver, ProblemDetailsFactory $problems)

Binds exception classification to canonical endpoint matching and problem response creation.

Parameters

ApiEndpointRequestResolver $endpointResolver
ProblemDetailsFactory $problems

resolve

ResponseInterface|null resolve(Throwable $exception, ServerRequestInterface $request)

Returns a 404 for routing failures, a generic 500 for other API failures, or null outside the API.

Parameters

Throwable $exception
ServerRequestInterface $request

Return Value

ResponseInterface|null