BloomRpcHttpException class

Exception thrown when the server returns a non-2xx HTTP error status code.

Carries the HTTP statusCode, the decoded responseBody, and automatically parses validation errors accessible via validationErrors.

try {
  await client.call(getUserContract, null);
} on BloomRpcHttpException catch (e) {
  if (e.isNotFound) {
    print('User does not exist');
  } else if (e.isServerError) {
    print('Server returned error: ${e.statusCode}');
  }
}
Implemented types

Constructors

BloomRpcHttpException({required int statusCode, dynamic responseBody, Map<String, String>? responseHeaders, BloomRpcContract? contract, Uri? uri, String? message})
Creates a BloomRpcHttpException with status code, response body, and endpoint details.

Properties

contract → BloomRpcContract?
The RPC contract that was executing when the error occurred, or null.
final
hashCode → int
The hash code for this object.
no setterinherited
isClientError → bool
Whether the status code is a client error in the 4xx range.
no setter
isForbidden → bool
Whether the status code represents a 403 Forbidden access denial.
no setter
isNotFound → bool
Whether the status code represents a 404 Not Found error.
no setter
isServerError → bool
Whether the status code is a server error in the 5xx range.
no setter
isUnauthorized → bool
Whether the status code represents a 401 Unauthorized authentication failure.
no setter
isValidationError → bool
Whether the status code represents a 400 Bad Request or 422 Unprocessable Entity validation error.
no setter
message → String
Error summary message.
final
responseBody → dynamic
Raw response body string or decoded JSON object.
final
responseHeaders → Map<String, String>?
Outgoing response headers returned by the server.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
statusCode → int
HTTP status code returned by the server (e.g. 400, 401, 403, 404, 422, 500).
final
uri → Uri?
The target URI of the failed request, or null.
final
validationErrors ↔ BloomRpcValidationErrors?
Lazily parsed validation errors when responseBody contains field validation failures.
latefinal

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited