ApiErrorX extension

on

Properties

isAuthError bool

Available on ApiError, provided by the ApiErrorX extension

True for auth errors (401 / 403)
no setter
isClientError bool

Available on ApiError, provided by the ApiErrorX extension

True for any 4xx client error
no setter
isNetworkRelated bool

Available on ApiError, provided by the ApiErrorX extension

True for any connectivity-related error (NetworkError, TimeoutError, BadCertificateError, CancelledError)
no setter
isServerError bool

Available on ApiError, provided by the ApiErrorX extension

True for any 5xx server error
no setter

Methods

maybeWhen<R>({R network(NetworkError e)?, R timeout(TimeoutError e)?, R badCertificate(BadCertificateError e)?, R cancelled(CancelledError e)?, R unauthorized(UnauthorizedError e)?, R forbidden(ForbiddenError e)?, R badRequest(BadRequestError e)?, R notFound(NotFoundError e)?, R methodNotAllowed(MethodNotAllowedError e)?, R conflict(ConflictError e)?, R validation(ValidationError e)?, R server(ServerError e)?, R app(AppError e)?, R unknown(UnknownError e)?, required R orElse(ApiError e)}) → R

Available on ApiError, provided by the ApiErrorX extension

Partial match — handle what you care about, delegate the rest
when<R>({required R network(NetworkError e), required R timeout(TimeoutError e), required R badCertificate(BadCertificateError e), required R cancelled(CancelledError e), required R unauthorized(UnauthorizedError e), required R forbidden(ForbiddenError e), required R badRequest(BadRequestError e), required R notFound(NotFoundError e), required R methodNotAllowed(MethodNotAllowedError e), required R conflict(ConflictError e), required R validation(ValidationError e), required R server(ServerError e), required R app(AppError e), required R unknown(UnknownError e)}) → R

Available on ApiError, provided by the ApiErrorX extension

Exhaustive pattern-match helper