Skip to main content

Class: UserError

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

Constructs an UserError.

Parameters​

ParameterTypeDescription
optionsOptionsThe UserError options

Returns​

UserError

Overrides​

Error.constructor

Defined in​

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

Properties​

context​

readonly context: unknown

User-provided context.

Defined in​

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


identifier​

readonly identifier: string

An identifier, useful to localize emitted errors.

Defined in​

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

Accessors​

name​

Get Signature​

get name(): string

Returns​

string

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

Overrides​

Error.name

Defined in​

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