Errors
What went wrong, told to the caller. Returned with fail().
Domains
Raising one
fail(intent, message?, options?) returns the Response: { ok: false, error, code } with the intent’s status. Name what went wrong; the intent sets the status, the message the caller sees, and any log it writes. Read the guide.
// The request cannot be read: invalid JSON, the wrong content type
return fail('request.malformed', 'Invalid JSON.');
// A required field or parameter is absent
return fail('request.missing', 'Handle is required.');
// A field breaks a rule: too long, the wrong format, out of range
return fail('request.invalid', 'Use 1–32 lowercase letters, numbers, or hyphens.');Looks
The statuses error intents are built from. Change a status here and every error built from it follows. Looks have no pages of their own; each is listed here with what it is built from and the intents built from it.
status.*
status.badrequest400: the request was wrong; the caller sees your message
status.unprocessable422: the request was readable but a value breaks a rule
Used to build:request.invalidstatus.unauthorized401: no valid credentials
status.forbidden403: valid credentials, not allowed
Used to build:permission.deniedstatus.notfound404: nothing there, as far as the caller may know
Used to build:record.missingstatus.conflict409: clashes with the current state
status.toomany429: too many requests or too much use
Used to build:limit.ratestatus.internal500: our fault; the caller sees a generic message
Used to build:failure.internalstatus.badgateway502: a dependency failed; the caller sees a generic message
Used to build:failure.upstream