RelayAPIError to read the status, the Relay code, and the trace ID of a failed request.
Inspect the error
The SDK throwsRelayAPIError for an error response after its configured retries are spent. Any other exception is a network or programming error and should propagate:
What you get back
When the chat ID does not exist, or belongs to a chat this agent is not in, Relay answers404 with code 2001. The SDK surfaces the same fields on the error object:
captured-output
When it fails
Branch on the code, not on the message. Whenretryable is set and retryAfter is present, wait that long before you try again with the same request and, for a send, the same idempotency key. Keep the trace ID in your logs and out of anything a person sees.

