@kismet.ts/shared / Exports / KismetError

Class: KismetError<T, Params>

Util class for throwing common errors

Type parameters

NameType
Textends MessageKey
Paramsextends MessageParams<T> = MessageParams<T>

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new KismetError<T, Params>(key, args?, options?)

Type parameters

NameType
Textends "FLOAT_INPUT" | "INDEX_DEFINED" | "INTEGER_INPUT" | "INVALID_COLORS_INPUT" | "INVALID_COLOR_TYPE" | "INVALID_COLOR_VALUE" | "INVALID_NODE_ARGUMENT" | "INVALID_PATH" | "INVALID_TYPE" | "PROJECT_DEFINED" | "RANGE_LOWER_MIN" | "SEQUENCE_DEFINED" | "SEQUENCE_EMPTY" | "UNKNOWN_CONNECTION"
Paramsextends any[] | [] | [type: string] | [min: number, max: number, value: number] | [path: string] | [input: unknown, type: string] | [name: string] | [name: string, obj: string, type: string] = MessageParams<T>

Parameters

NameType
keyT
args?Params
options?Object
options.cause?Error
options.data?Record<string, unknown>
options.error?boolean

Defined in

error/Error.ts:37open in new window

Properties

Messages

Static Messages: Object = Messages

Default messages for the error

Type declaration

NameType
FLOAT_INPUTstring
INDEX_DEFINEDstring
INTEGER_INPUTstring
INVALID_COLORS_INPUTstring
INVALID_COLOR_TYPE(type: string) => string
INVALID_COLOR_VALUE(min: number, max: number, value: number) => string
INVALID_NODE_ARGUMENTstring
INVALID_PATH(path: string) => string
INVALID_TYPE(input: unknown, type: string) => string
PROJECT_DEFINEDstring
RANGE_LOWER_MINstring
SEQUENCE_DEFINEDstring
SEQUENCE_EMPTY(name: string) => string
UNKNOWN_CONNECTION(name: string, obj: string, type: string) => string

Defined in

error/Error.ts:26open in new window

Methods

addMessage

Static addMessage(key, value): void

Define a new message for throwing errors

Parameters

NameTypeDescription
keystringThe key for the error. Used as new KismetError('your_key')
valuestring | FunctionThe function or message assiocated with the key

Returns

void

Defined in

error/Error.ts:33open in new window