Skip to main content

Class: UserError

Defined in: projects/framework/src/lib/errors/UserError.ts:13

The UserError class to be emitted in the pieces.

Example

throw new UserError({
identifier: 'AddArgumentError',
message: 'You must write two numbers, but the second one did not match.',
context: { received: 2, expected: 3 }
});

Extends

Extended by

Constructors

new UserError()

new UserError(options: Options): UserError

Defined in: projects/framework/src/lib/errors/UserError.ts:28

Constructs an UserError.

Parameters

ParameterTypeDescription
optionsOptionsThe UserError options

Returns

UserError

Overrides

Error.constructor

Properties

context

readonly context: unknown

Defined in: projects/framework/src/lib/errors/UserError.ts:22

User-provided context.


identifier

readonly identifier: string

Defined in: projects/framework/src/lib/errors/UserError.ts:17

An identifier, useful to localize emitted errors.

Accessors

name

Get Signature

get name(): string

Defined in: projects/framework/src/lib/errors/UserError.ts:35

Returns

string

This will be 'UserError' and can be used to distinguish the type of error when any error gets thrown

Overrides

Error.name