SdkError class final

Stable typed boundary for RPC failures.

The SDK throws SdkError from every public surface (generated stubs, L1.5 ergonomic wrappers, Layer 3 companions). Wraps a ConnectException when one is available; for non-RPC failures (e.g. a caller-side bug detected before the call leaves the SDK) build with SdkError.local.

Implemented types

Constructors

SdkError.fromConnectException(ConnectException error)
Builds an SdkError from a ConnectException, preserving the code, message, cause, details, and metadata.
factory
SdkError.local({required SdkErrorCode code, required String message, Object? cause})
Builds an SdkError for a caller-side failure that never reached the wire (e.g. an invalid argument detected by an L1.5 helper).
factory

Properties

cause Object?
Underlying cause when one is available. Preserved so log pipelines can inspect the original transport exception without re-throwing it.
final
code SdkErrorCode
Classification code. Mirrors the Connect / gRPC status taxonomy.
final
details List<SdkErrorDetail>
Server-supplied error details, e.g. google.rpc.RetryInfo, google.rpc.BadRequest. Carried as raw protobuf bytes; companion packages decode known types.
final
hashCode int
The hash code for this object.
no setterinherited
message String
Human-readable message. Not stable across versions; useful for logs but never parse it programmatically.
final
metadata Map<String, List<String>>
Response metadata (union of headers and trailers) attached to the failing call. Names are lowercased per HTTP convention.
final
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
toString() String
A string representation of this object.
override

Operators

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