@kismet.ts/shared / Exports / KismetError
Class: KismetError<T, Params>
Util class for throwing common errors
Type parameters
| Name | Type |
|---|---|
T | extends MessageKey |
Params | extends MessageParams<T> = MessageParams<T> |
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new KismetError<T, Params>(key, args?, options?)
Type parameters
| Name | Type |
|---|---|
T | extends "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" |
Params | extends 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
| Name | Type |
|---|---|
key | T |
args? | Params |
options? | Object |
options.cause? | Error |
options.data? | Record<string, unknown> |
options.error? | boolean |
Defined in
Properties
Messages
▪ Static Messages: Object = Messages
Default messages for the error
Type declaration
| Name | Type |
|---|---|
FLOAT_INPUT | string |
INDEX_DEFINED | string |
INTEGER_INPUT | string |
INVALID_COLORS_INPUT | string |
INVALID_COLOR_TYPE | (type: string) => string |
INVALID_COLOR_VALUE | (min: number, max: number, value: number) => string |
INVALID_NODE_ARGUMENT | string |
INVALID_PATH | (path: string) => string |
INVALID_TYPE | (input: unknown, type: string) => string |
PROJECT_DEFINED | string |
RANGE_LOWER_MIN | string |
SEQUENCE_DEFINED | string |
SEQUENCE_EMPTY | (name: string) => string |
UNKNOWN_CONNECTION | (name: string, obj: string, type: string) => string |
Defined in
Methods
addMessage
▸ Static addMessage(key, value): void
Define a new message for throwing errors
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The key for the error. Used as new KismetError('your_key') |
value | string | Function | The function or message assiocated with the key |
Returns
void