IMessageError on failure. Use instanceof to branch on the specific error type - no boolean getters, no magic strings.
Error hierarchy
| gRPC status | SDK error class |
|---|---|
UNAUTHENTICATED, PERMISSION_DENIED | AuthenticationError |
NOT_FOUND | NotFoundError |
RESOURCE_EXHAUSTED | RateLimitError |
INVALID_ARGUMENT, FAILED_PRECONDITION | ValidationError |
UNAVAILABLE, DEADLINE_EXCEEDED | ConnectionError |
| All others | IMessageError (base class) |
Basic usage
IMessageError properties
All error subclasses inherit:retryable flag is read from the server’s gRPC trailing metadata (x-retryable header), so it is determined by the server on a per-response basis. By convention, RateLimitError and ConnectionError are typically retryable, but the server may override this for any error type.
Error codes
ErrorCode has 22 values across 6 categories:
| Category | Error codes |
|---|---|
| Authentication | unauthenticated, tokenExpired, tokenBlocked, unauthorized |
| Rate limiting | dailyLimitExceeded, recipientLimitExceeded |
| Deduplication | duplicateMessage |
| Not found | chatNotFound, messageNotFound, attachmentNotFound, addressNotFound, scheduledMessageNotFound, pollNotFound |
| Validation | invalidArgument, preconditionFailed, operationNotSupported, privateApiUnavailable |
| Infrastructure | serviceUnavailable, timeout, internalError, databaseError, networkError |
Retrying with the SDK
Setretry: true (or a RetryOptions object) in createClient to let the SDK handle transient retries automatically:
retry is enabled, ConnectionError and RateLimitError are retried transparently before the error propagates to your code.
Escape hatch: _raw
Most domain types carry _raw containing the raw gRPC response for debugging purposes. The types that include _raw are Chat, Message, AttachmentInfo, and AddressInfo. Other types such as ScheduledMessage, FindMyFriend, and PollInfo do not include _raw.