Skip to main content
Catch RelayAPIError to read the status, the Relay code, and the trace ID of a failed request.

Inspect the error

The SDK throws RelayAPIError 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 answers 404 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. When retryable 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.

Next steps