Skip to main content
Version: 2.2.0

Class: UnknownError

A fallback error thrown by any unknown sources or unexpected failure that are not of NameError.

In this particular case, an origin remains useful as it provides details on the sources and the true nature of the unexpected error. At this point, deciding whether to exit the program or not depends on the programmer.

Extends​

Constructors​

Constructor​

new UnknownError(error): UnknownError

Creates a new UnknownError with an optional error message. Optionally, the original error revealing the true nature of the failure.

Parameters​

error​

ErrorMessage & object

Returns​

UnknownError

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


origin?​

readonly optional origin?: Error

The possible unknown error, with trace revealing its source and reason.


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

Overrides​

NameError.toString