ErrorMappingInterceptor class
Maps responses to registered FailureFactorys so safeCall can surface
typed Failures.
Endpoint lookup supports literal paths, {param} templates and the *
catch-all — see ErrorRegistry.resolveEndpointFactory.
When a factory throws, ErrorRegistry.onMappingError is invoked and the response is processed as if no mapping existed.
Note on mapped success statuses (e.g. a 202 registered as an error): the
response is converted into a synthetic rejection that is consumed by
safeCall via response.extra. This rejection intentionally does NOT run
through other interceptors' onError — a retry or logging interceptor
never sees it, because on the wire the request succeeded.
Constructors
- ErrorMappingInterceptor({required ErrorRegistry errorRegistry})
Properties
- errorRegistry → ErrorRegistry
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onError(
DioException err, ErrorInterceptorHandler handler) → void - Called when an exception was occurred during the request.
-
onRequest(
RequestOptions options, RequestInterceptorHandler handler) → void -
Called when the request is about to be sent.
inherited
-
onResponse(
Response response, ResponseInterceptorHandler handler) → void - Called when the response is about to be resolved.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited