Skip to main content
Version: 2.2.0

Class: InputError

An error thrown when a name source input is incorrect.

A Name is a name for this utility under certain criteria (i.e., 1+ chars), hence, a wrong input will cause this kind of error. Another common reason may be a wrong key in a JSON name parsing mechanism.

Keep in mind that this error is different from a ValidationError.

Extends​

Constructors​

Constructor​

new InputError(error): InputError

Creates a new InputError with an optional error message.

The name source is by nature a string content, maybe wrapped up in a different type. This string value may be extracted to form the following output: "InputError (stringName)", "InputError (stringName): message".

Parameters​

error​

ErrorMessage

Returns​

InputError

Overrides​

NameError.constructor

Properties​

cause?​

optional cause?: unknown

Inherited from​

NameError.cause


message​

message: string

Inherited from​

NameError.message


name​

name: string

Inherited from​

NameError.name


source​

readonly source: string | string[]

Inherited from​

NameError.source


stack?​

optional stack?: string

Inherited from​

NameError.stack


type​

readonly type: NameErrorType

Inherited from​

NameError.type

Accessors​

hasMessage​

Get Signature​

get hasMessage(): boolean

Whether a message describing the failure exists.

Returns​

boolean

Inherited from​

NameError.hasMessage


sourceAsString​

Get Signature​

get sourceAsString(): string

The actual source input which caused the error.

Returns​

string

Inherited from​

NameError.sourceAsString

Methods​

toString()​

toString(): string

Returns a string representation of the error.

Returns​

string

Inherited from​

NameError.toString