Skip to main content

Error envelope

Errors come back as a NestJS error object.
When the failure is request validation, message is an array of field-level messages instead of a string. Handle both shapes.

Status codes

A 500 is the one response that does not carry an error field — NestJS’s default handler returns only statusCode and message:
Retry it with backoff. Every other status returns all three fields.

Reading a 403

403 covers three different situations, separated only by the message.

Endpoints that report failure in the body

Two endpoints return a success status with a failure payload. Branch on the body, not the status code.
A domain already registered by another account returns 201 with domainId: null and an error string. Check domainId before treating the call as a success.
A failed CNAME check returns 200 with verified: false and the cnameTarget to publish. Branch on verified.

Handling errors

Retry 5xx responses and network timeouts with exponential backoff and jitter. Never retry a 4xx — the request itself is the problem.