Northlight
PluginReference

Errors

Failing a leaf with an exit code, a message and optional remediation.

Exports of @north-light/plugin, read from the TypeScript compiler at build time. Types re-exported from @north-light/api are documented with that package.

LeafError

class declared in errors.ts

Throw this from a handler to report an expected application error. The Fetch handler turns it into the non-2xx error envelope crtr reads; anything else thrown becomes a 500 handler_failed. The constructor throws when code is reserved or malformed, or when status is outside 400–599, and throws PluginDefinitionError for unauthorized, scope_missing, and approval_required, which only the kit's own helpers emit. provider_refused always has status 403. retryAfter and headers become response headers on the error response; for a side-effect leaf they are also stored with the answer (when the RequestStore keeps answer.headers) so a repeated request gets them again.

Prop

Type

LeafErrorOptions

interface declared in errors.ts

What a LeafError reports.

Prop

Type

LeafErrorQuestion

interface declared in errors.ts

What an approval_required error asks the user.

Prop

Type

On this page