Skip to content

FlareError

class FlareError<TDetail extends ErrorSchema<JsonValue> | undefined = undefined> extends Error

Application error with a stable name, category, optional numeric code, and exposure flag.

The expose flag governs whether attached detail data may leave the server.

new FlareError(descriptor, args)

new FlareError(descriptor: ErrorCodeDescriptor<TDetail>, ...args: conditional): FlareError<TDetail>

Builds a FlareError from a code descriptor and a detail value when a schema is declared.

descriptor ErrorCodeDescriptor<TDetail>

...args conditional

category: "invalid" | "too_large" | "rejected" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "throttled" | "unavailable" | "fault"
code: number | undefined
expose: boolean
name: string
get detail(): FlareErrorDetail<TDetail> | undefined

Returns the attached detail when expose is true, otherwise undefined.

returns FlareErrorDetail<TDetail> | undefined

get rawDetail(): FlareErrorDetail<TDetail> | undefined

Returns the attached detail regardless of the expose flag, for server-side logging.

returns FlareErrorDetail<TDetail> | undefined

Learn: Typed errors

Last updated: