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

Source

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

Properties

context

readonly context: unknown

User-provided context.

Source

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


identifier

readonly identifier: string

An identifier, useful to localize emitted errors.

Source

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

Accessors

name

get name(): string

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

Returns

string

Source

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