Skip to content

basalt / fastify/src / HttpError

Class: HttpError ​

Defined in: http/src/errors.ts:48

Intentional HTTP error throwable from any layer: throw new HttpError(404, 'PROJECT_NOT_FOUND', 'Project not found')

With a structured payload for the UI to act on: throw new HttpError(422, 'CHECKS_FAILED', 'Checks failed.', { details: { failed: ['age'] } })

Extends ​

Constructors ​

Constructor ​

> new HttpError(status, code, message, options?): HttpError

Defined in: http/src/errors.ts:49

Parameters ​

status ​

number

code ​

string

message ​

string

options? ​

HttpErrorOptions

Returns ​

HttpError

Overrides ​

BasaltError.constructor

Properties ​

code ​

> readonly code: string

Defined in: core/src/errors.ts:25

Inherited from ​

BasaltError.code


details? ​

> readonly optional details?: Record<string, unknown>

Defined in: core/src/errors.ts:28

Structured payload passed to the constructor, exactly as given (never sanitised here).

Inherited from ​

BasaltError.details


internalDetails? ​

> readonly optional internalDetails?: ErrorDetails

Defined in: http/src/errors.ts:69

Log-only payload from options.internalDetails (see HttpErrorOptions).


status ​

> readonly status: number

Defined in: http/src/errors.ts:50

Released under the MIT License.