Admits only 2xx responses from the wrapped Fetch implementation, rejecting the others as
problems. Paired with resolve declared below it, transport failures are
rejected as problems too, so that a failed exchange is handled in one shape whatever caused it.
The same shape is available on its own to code handling failures raised elsewhere: any value may be recognised as a
problem, or normalised into one, so that a handler branches on problem details without first telling apart what it
was handed.
It is the converse of resolve, which turns failed exchanges into responses.
Unsuccessful response rejection middleware.
Admits only 2xx responses from the wrapped Fetch implementation, rejecting the others as problems. Paired with resolve declared below it, transport failures are rejected as problems too, so that a failed exchange is handled in one shape whatever caused it.
The same shape is available on its own to code handling failures raised elsewhere: any value may be recognised as a problem, or normalised into one, so that a handler branches on problem details without first telling apart what it was handed.
It is the converse of resolve, which turns failed exchanges into responses.
Usage
See
RFC 9457 - Problem Details for HTTP APIs