blecsd 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +220 -0
- package/dist/3d/index.d.ts +5 -0
- package/dist/3d/index.js +1 -0
- package/dist/audio/index.d.ts +177 -0
- package/dist/audio/index.js +1 -0
- package/dist/border-D_Jb4ZJV.d.ts +257 -0
- package/dist/cell-DwIu2ryP.d.ts +505 -0
- package/dist/chunk-2UBBZFE4.js +1 -0
- package/dist/chunk-35LCBY6P.js +1 -0
- package/dist/chunk-3B7MIVW6.js +1 -0
- package/dist/chunk-3EGGGI5J.js +3 -0
- package/dist/chunk-4LWWONFK.js +1 -0
- package/dist/chunk-4X4N4HNQ.js +2 -0
- package/dist/chunk-5PELJRUQ.js +1 -0
- package/dist/chunk-AEJIX2MW.js +1 -0
- package/dist/chunk-AQ7LW75B.js +1 -0
- package/dist/chunk-AXZQAH4X.js +1 -0
- package/dist/chunk-B6Z2JFRY.js +1 -0
- package/dist/chunk-BCADUCOZ.js +1 -0
- package/dist/chunk-C5PCEQ6G.js +1 -0
- package/dist/chunk-CIK4AMUA.js +1 -0
- package/dist/chunk-DNRXW56C.js +1 -0
- package/dist/chunk-FC5FFAAC.js +12 -0
- package/dist/chunk-FGHEFXLK.js +1 -0
- package/dist/chunk-FYEBZAWN.js +1 -0
- package/dist/chunk-G7GIWWLE.js +1 -0
- package/dist/chunk-GYHI26UE.js +1 -0
- package/dist/chunk-H2YAOJDW.js +1 -0
- package/dist/chunk-J4JZ2NU2.js +1 -0
- package/dist/chunk-JKVHO4LH.js +1 -0
- package/dist/chunk-K2B2OXQ5.js +5 -0
- package/dist/chunk-K37L3G4Z.js +4 -0
- package/dist/chunk-KD55INV7.js +1 -0
- package/dist/chunk-KFAK4A3G.js +1 -0
- package/dist/chunk-LCN2ZITE.js +1 -0
- package/dist/chunk-LYSK5S63.js +1 -0
- package/dist/chunk-NZ55KBM6.js +1 -0
- package/dist/chunk-OMMJ7B5P.js +1 -0
- package/dist/chunk-OUXUPF3V.js +33 -0
- package/dist/chunk-OVT2PPGW.js +19 -0
- package/dist/chunk-P6CJO3BC.js +1 -0
- package/dist/chunk-PSXXMBVJ.js +1 -0
- package/dist/chunk-PXXGH3BV.js +1 -0
- package/dist/chunk-QIKIOVP2.js +1 -0
- package/dist/chunk-SHUC6JWA.js +1 -0
- package/dist/chunk-TDXJDLY6.js +6 -0
- package/dist/chunk-TWSWTBYL.js +1 -0
- package/dist/chunk-TYMY2TBR.js +3 -0
- package/dist/chunk-VNZ6CWJA.js +2 -0
- package/dist/chunk-VOCM5T2G.js +5 -0
- package/dist/chunk-W5OU7Z6J.js +1 -0
- package/dist/chunk-WNG4A3K7.js +4 -0
- package/dist/chunk-XQIGERNI.js +1 -0
- package/dist/chunk-XZA63ZPO.js +1 -0
- package/dist/chunk-YAMOSPWB.js +4 -0
- package/dist/chunk-YD6ULIUR.js +1 -0
- package/dist/chunk-Z4EZERNE.js +1 -0
- package/dist/cli/init.d.ts +86 -0
- package/dist/cli/init.js +179 -0
- package/dist/color-B78w3zH-.d.ts +79 -0
- package/dist/components/index.d.ts +10298 -0
- package/dist/components/index.js +1 -0
- package/dist/core/index.d.ts +6700 -0
- package/dist/core/index.js +1 -0
- package/dist/debug/index.d.ts +711 -0
- package/dist/debug/index.js +1 -0
- package/dist/doubleBuffer-CKQFmlPN.d.ts +95 -0
- package/dist/errors/index.d.ts +1110 -0
- package/dist/errors/index.js +1 -0
- package/dist/events-BbbxkgvX.d.ts +125 -0
- package/dist/game/index.d.ts +486 -0
- package/dist/game/index.js +1 -0
- package/dist/gameLoop-BIPW7-OY.d.ts +219 -0
- package/dist/index-zSGJ2eUk.d.ts +3156 -0
- package/dist/index.d.ts +246 -0
- package/dist/index.js +1 -0
- package/dist/input/index.d.ts +158 -0
- package/dist/input/index.js +1 -0
- package/dist/inputActions-CefRUBuT.d.ts +2637 -0
- package/dist/keyParser-Bwm8-l7v.d.ts +229 -0
- package/dist/mouseParser-Cfrbn3AX.d.ts +177 -0
- package/dist/parser-iMHmQuUh.d.ts +265 -0
- package/dist/program-BZaKqDKH.d.ts +141 -0
- package/dist/renderable-jTMOA-GK.d.ts +302 -0
- package/dist/scheduler-DcfoFuum.d.ts +86 -0
- package/dist/schemas/index.d.ts +936 -0
- package/dist/schemas/index.js +1 -0
- package/dist/systems/index.d.ts +4036 -0
- package/dist/systems/index.js +1 -0
- package/dist/terminal/index.d.ts +7357 -0
- package/dist/terminal/index.js +1 -0
- package/dist/terminus-14-bold-HWSPRLJD.js +1 -0
- package/dist/terminus-14-normal-T3SWMH4D.js +1 -0
- package/dist/tilemap-D1HJvKy3.d.ts +1211 -0
- package/dist/types-BcsvoKzf.d.ts +68 -0
- package/dist/utils/index.d.ts +6104 -0
- package/dist/utils/index.js +1 -0
- package/dist/viewport3d-xI33-_wq.d.ts +182 -0
- package/dist/virtualScrollback-DvZTRU8a.d.ts +274 -0
- package/dist/virtualViewport-Dx2iJliO.d.ts +2334 -0
- package/dist/virtualizedLineStore-DwPEvPkk.d.ts +297 -0
- package/dist/widgets/bigText.d.ts +230 -0
- package/dist/widgets/bigText.js +1 -0
- package/dist/widgets/fonts/index.d.ts +211 -0
- package/dist/widgets/fonts/index.js +1 -0
- package/dist/widgets/index.d.ts +8591 -0
- package/dist/widgets/index.js +1 -0
- package/package.json +213 -0
|
@@ -0,0 +1,1110 @@
|
|
|
1
|
+
import { core } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error code constants for the BlECSd library.
|
|
5
|
+
*
|
|
6
|
+
* Error codes follow the pattern: `<CATEGORY>_<SPECIFIC_ERROR>`
|
|
7
|
+
* where CATEGORY matches the BlECSdErrorKind.
|
|
8
|
+
*
|
|
9
|
+
* @module errors/codes
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Validation error codes for input/config validation failures.
|
|
13
|
+
*/
|
|
14
|
+
declare const ValidationErrorCode: {
|
|
15
|
+
/** Generic validation failure */
|
|
16
|
+
readonly INVALID_INPUT: "VALIDATION_INVALID_INPUT";
|
|
17
|
+
/** Invalid hex color format */
|
|
18
|
+
readonly INVALID_HEX_COLOR: "VALIDATION_INVALID_HEX_COLOR";
|
|
19
|
+
/** Invalid hex color length */
|
|
20
|
+
readonly INVALID_HEX_LENGTH: "VALIDATION_INVALID_HEX_LENGTH";
|
|
21
|
+
/** Invalid color object */
|
|
22
|
+
readonly INVALID_COLOR_OBJECT: "VALIDATION_INVALID_COLOR_OBJECT";
|
|
23
|
+
/** Invalid color value */
|
|
24
|
+
readonly INVALID_COLOR_VALUE: "VALIDATION_INVALID_COLOR_VALUE";
|
|
25
|
+
/** Invalid palette index */
|
|
26
|
+
readonly INVALID_PALETTE_INDEX: "VALIDATION_INVALID_PALETTE_INDEX";
|
|
27
|
+
/** Invalid color cube index */
|
|
28
|
+
readonly INVALID_CUBE_INDEX: "VALIDATION_INVALID_CUBE_INDEX";
|
|
29
|
+
/** Invalid grayscale index */
|
|
30
|
+
readonly INVALID_GRAYSCALE_INDEX: "VALIDATION_INVALID_GRAYSCALE_INDEX";
|
|
31
|
+
/** Invalid dimension value */
|
|
32
|
+
readonly INVALID_DIMENSION: "VALIDATION_INVALID_DIMENSION";
|
|
33
|
+
/** Invalid buffer dimensions */
|
|
34
|
+
readonly INVALID_BUFFER_DIMENSIONS: "VALIDATION_INVALID_BUFFER_DIMENSIONS";
|
|
35
|
+
/** Invalid surrogate pair */
|
|
36
|
+
readonly INVALID_SURROGATE_PAIR: "VALIDATION_INVALID_SURROGATE_PAIR";
|
|
37
|
+
/** Schema validation failed */
|
|
38
|
+
readonly SCHEMA_VALIDATION_FAILED: "VALIDATION_SCHEMA_FAILED";
|
|
39
|
+
/** Required field missing */
|
|
40
|
+
readonly REQUIRED_FIELD_MISSING: "VALIDATION_REQUIRED_FIELD_MISSING";
|
|
41
|
+
/** Value out of range */
|
|
42
|
+
readonly VALUE_OUT_OF_RANGE: "VALIDATION_VALUE_OUT_OF_RANGE";
|
|
43
|
+
};
|
|
44
|
+
type ValidationErrorCodeType = (typeof ValidationErrorCode)[keyof typeof ValidationErrorCode];
|
|
45
|
+
/**
|
|
46
|
+
* Terminal error codes for terminal I/O and capability failures.
|
|
47
|
+
*/
|
|
48
|
+
declare const TerminalErrorCode: {
|
|
49
|
+
/** Generic terminal error */
|
|
50
|
+
readonly TERMINAL_ERROR: "TERMINAL_ERROR";
|
|
51
|
+
/** Terminal not initialized */
|
|
52
|
+
readonly NOT_INITIALIZED: "TERMINAL_NOT_INITIALIZED";
|
|
53
|
+
/** Terminal already initialized */
|
|
54
|
+
readonly ALREADY_INITIALIZED: "TERMINAL_ALREADY_INITIALIZED";
|
|
55
|
+
/** Terminfo file not found */
|
|
56
|
+
readonly TERMINFO_NOT_FOUND: "TERMINAL_TERMINFO_NOT_FOUND";
|
|
57
|
+
/** Capability negotiation not started */
|
|
58
|
+
readonly NEGOTIATION_NOT_STARTED: "TERMINAL_NEGOTIATION_NOT_STARTED";
|
|
59
|
+
/** Capability negotiation already started */
|
|
60
|
+
readonly NEGOTIATION_ALREADY_STARTED: "TERMINAL_NEGOTIATION_ALREADY_STARTED";
|
|
61
|
+
/** Capability not supported */
|
|
62
|
+
readonly CAPABILITY_NOT_SUPPORTED: "TERMINAL_CAPABILITY_NOT_SUPPORTED";
|
|
63
|
+
/** Terminal write failed */
|
|
64
|
+
readonly WRITE_FAILED: "TERMINAL_WRITE_FAILED";
|
|
65
|
+
/** Terminal read failed */
|
|
66
|
+
readonly READ_FAILED: "TERMINAL_READ_FAILED";
|
|
67
|
+
/** Terminal cleanup failed */
|
|
68
|
+
readonly CLEANUP_FAILED: "TERMINAL_CLEANUP_FAILED";
|
|
69
|
+
};
|
|
70
|
+
type TerminalErrorCodeType = (typeof TerminalErrorCode)[keyof typeof TerminalErrorCode];
|
|
71
|
+
/**
|
|
72
|
+
* System error codes for ECS system and game loop failures.
|
|
73
|
+
*/
|
|
74
|
+
declare const SystemErrorCode: {
|
|
75
|
+
/** Generic system error */
|
|
76
|
+
readonly SYSTEM_ERROR: "SYSTEM_ERROR";
|
|
77
|
+
/** Game loop already running */
|
|
78
|
+
readonly LOOP_ALREADY_RUNNING: "SYSTEM_LOOP_ALREADY_RUNNING";
|
|
79
|
+
/** Game loop not running */
|
|
80
|
+
readonly LOOP_NOT_RUNNING: "SYSTEM_LOOP_NOT_RUNNING";
|
|
81
|
+
/** Cannot change world while running */
|
|
82
|
+
readonly CANNOT_CHANGE_WORLD: "SYSTEM_CANNOT_CHANGE_WORLD";
|
|
83
|
+
/** System execution failed */
|
|
84
|
+
readonly SYSTEM_EXECUTION_FAILED: "SYSTEM_EXECUTION_FAILED";
|
|
85
|
+
/** Phase not found */
|
|
86
|
+
readonly PHASE_NOT_FOUND: "SYSTEM_PHASE_NOT_FOUND";
|
|
87
|
+
/** Phase already exists */
|
|
88
|
+
readonly PHASE_ALREADY_EXISTS: "SYSTEM_PHASE_ALREADY_EXISTS";
|
|
89
|
+
/** Invalid phase order */
|
|
90
|
+
readonly INVALID_PHASE_ORDER: "SYSTEM_INVALID_PHASE_ORDER";
|
|
91
|
+
/** Scheduler not initialized */
|
|
92
|
+
readonly SCHEDULER_NOT_INITIALIZED: "SYSTEM_SCHEDULER_NOT_INITIALIZED";
|
|
93
|
+
};
|
|
94
|
+
type SystemErrorCodeType = (typeof SystemErrorCode)[keyof typeof SystemErrorCode];
|
|
95
|
+
/**
|
|
96
|
+
* Entity error codes for ECS entity management failures.
|
|
97
|
+
*/
|
|
98
|
+
declare const EntityErrorCode: {
|
|
99
|
+
/** Generic entity error */
|
|
100
|
+
readonly ENTITY_ERROR: "ENTITY_ERROR";
|
|
101
|
+
/** Entity not found */
|
|
102
|
+
readonly NOT_FOUND: "ENTITY_NOT_FOUND";
|
|
103
|
+
/** Entity already exists (e.g., singleton violation) */
|
|
104
|
+
readonly ALREADY_EXISTS: "ENTITY_ALREADY_EXISTS";
|
|
105
|
+
/** Screen entity already exists */
|
|
106
|
+
readonly SCREEN_ALREADY_EXISTS: "ENTITY_SCREEN_ALREADY_EXISTS";
|
|
107
|
+
/** Invalid entity ID */
|
|
108
|
+
readonly INVALID_ID: "ENTITY_INVALID_ID";
|
|
109
|
+
/** Entity missing required component */
|
|
110
|
+
readonly MISSING_COMPONENT: "ENTITY_MISSING_COMPONENT";
|
|
111
|
+
/** Entity hierarchy error */
|
|
112
|
+
readonly HIERARCHY_ERROR: "ENTITY_HIERARCHY_ERROR";
|
|
113
|
+
};
|
|
114
|
+
type EntityErrorCodeType = (typeof EntityErrorCode)[keyof typeof EntityErrorCode];
|
|
115
|
+
/**
|
|
116
|
+
* Component error codes for ECS component failures.
|
|
117
|
+
*/
|
|
118
|
+
declare const ComponentErrorCode: {
|
|
119
|
+
/** Generic component error */
|
|
120
|
+
readonly COMPONENT_ERROR: "COMPONENT_ERROR";
|
|
121
|
+
/** Component not found on entity */
|
|
122
|
+
readonly NOT_FOUND: "COMPONENT_NOT_FOUND";
|
|
123
|
+
/** Component already exists on entity */
|
|
124
|
+
readonly ALREADY_EXISTS: "COMPONENT_ALREADY_EXISTS";
|
|
125
|
+
/** Invalid component data */
|
|
126
|
+
readonly INVALID_DATA: "COMPONENT_INVALID_DATA";
|
|
127
|
+
/** Component store not initialized */
|
|
128
|
+
readonly STORE_NOT_INITIALIZED: "COMPONENT_STORE_NOT_INITIALIZED";
|
|
129
|
+
};
|
|
130
|
+
type ComponentErrorCodeType = (typeof ComponentErrorCode)[keyof typeof ComponentErrorCode];
|
|
131
|
+
/**
|
|
132
|
+
* Input error codes for input handling failures.
|
|
133
|
+
*/
|
|
134
|
+
declare const InputErrorCode: {
|
|
135
|
+
/** Generic input error */
|
|
136
|
+
readonly INPUT_ERROR: "INPUT_ERROR";
|
|
137
|
+
/** Invalid key sequence */
|
|
138
|
+
readonly INVALID_KEY_SEQUENCE: "INPUT_INVALID_KEY_SEQUENCE";
|
|
139
|
+
/** Invalid mouse event */
|
|
140
|
+
readonly INVALID_MOUSE_EVENT: "INPUT_INVALID_MOUSE_EVENT";
|
|
141
|
+
/** Input handler not registered */
|
|
142
|
+
readonly HANDLER_NOT_REGISTERED: "INPUT_HANDLER_NOT_REGISTERED";
|
|
143
|
+
/** Input buffer overflow */
|
|
144
|
+
readonly BUFFER_OVERFLOW: "INPUT_BUFFER_OVERFLOW";
|
|
145
|
+
};
|
|
146
|
+
type InputErrorCodeType = (typeof InputErrorCode)[keyof typeof InputErrorCode];
|
|
147
|
+
/**
|
|
148
|
+
* Render error codes for rendering failures.
|
|
149
|
+
*/
|
|
150
|
+
declare const RenderErrorCode: {
|
|
151
|
+
/** Generic render error */
|
|
152
|
+
readonly RENDER_ERROR: "RENDER_ERROR";
|
|
153
|
+
/** Buffer not initialized */
|
|
154
|
+
readonly BUFFER_NOT_INITIALIZED: "RENDER_BUFFER_NOT_INITIALIZED";
|
|
155
|
+
/** Invalid cell coordinates */
|
|
156
|
+
readonly INVALID_COORDINATES: "RENDER_INVALID_COORDINATES";
|
|
157
|
+
/** Screen buffer overflow */
|
|
158
|
+
readonly BUFFER_OVERFLOW: "RENDER_BUFFER_OVERFLOW";
|
|
159
|
+
/** Render cycle timeout */
|
|
160
|
+
readonly CYCLE_TIMEOUT: "RENDER_CYCLE_TIMEOUT";
|
|
161
|
+
};
|
|
162
|
+
type RenderErrorCodeType = (typeof RenderErrorCode)[keyof typeof RenderErrorCode];
|
|
163
|
+
/**
|
|
164
|
+
* Config error codes for configuration failures.
|
|
165
|
+
*/
|
|
166
|
+
declare const ConfigErrorCode: {
|
|
167
|
+
/** Generic config error */
|
|
168
|
+
readonly CONFIG_ERROR: "CONFIG_ERROR";
|
|
169
|
+
/** Invalid game config */
|
|
170
|
+
readonly INVALID_GAME_CONFIG: "CONFIG_INVALID_GAME_CONFIG";
|
|
171
|
+
/** Invalid screen config */
|
|
172
|
+
readonly INVALID_SCREEN_CONFIG: "CONFIG_INVALID_SCREEN_CONFIG";
|
|
173
|
+
/** Invalid widget config */
|
|
174
|
+
readonly INVALID_WIDGET_CONFIG: "CONFIG_INVALID_WIDGET_CONFIG";
|
|
175
|
+
/** Missing required config */
|
|
176
|
+
readonly MISSING_REQUIRED: "CONFIG_MISSING_REQUIRED";
|
|
177
|
+
};
|
|
178
|
+
type ConfigErrorCodeType = (typeof ConfigErrorCode)[keyof typeof ConfigErrorCode];
|
|
179
|
+
/**
|
|
180
|
+
* Internal error codes for library internal failures.
|
|
181
|
+
* These indicate bugs in the library itself.
|
|
182
|
+
*/
|
|
183
|
+
declare const InternalErrorCode: {
|
|
184
|
+
/** Generic internal error */
|
|
185
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
186
|
+
/** Unexpected state */
|
|
187
|
+
readonly UNEXPECTED_STATE: "INTERNAL_UNEXPECTED_STATE";
|
|
188
|
+
/** Assertion failed */
|
|
189
|
+
readonly ASSERTION_FAILED: "INTERNAL_ASSERTION_FAILED";
|
|
190
|
+
/** Not implemented */
|
|
191
|
+
readonly NOT_IMPLEMENTED: "INTERNAL_NOT_IMPLEMENTED";
|
|
192
|
+
/** Unreachable code path */
|
|
193
|
+
readonly UNREACHABLE: "INTERNAL_UNREACHABLE";
|
|
194
|
+
};
|
|
195
|
+
type InternalErrorCodeType = (typeof InternalErrorCode)[keyof typeof InternalErrorCode];
|
|
196
|
+
/**
|
|
197
|
+
* All BlECSd error codes combined.
|
|
198
|
+
*/
|
|
199
|
+
declare const BlECSdErrorCode: {
|
|
200
|
+
/** Generic internal error */
|
|
201
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
202
|
+
/** Unexpected state */
|
|
203
|
+
readonly UNEXPECTED_STATE: "INTERNAL_UNEXPECTED_STATE";
|
|
204
|
+
/** Assertion failed */
|
|
205
|
+
readonly ASSERTION_FAILED: "INTERNAL_ASSERTION_FAILED";
|
|
206
|
+
/** Not implemented */
|
|
207
|
+
readonly NOT_IMPLEMENTED: "INTERNAL_NOT_IMPLEMENTED";
|
|
208
|
+
/** Unreachable code path */
|
|
209
|
+
readonly UNREACHABLE: "INTERNAL_UNREACHABLE";
|
|
210
|
+
/** Generic config error */
|
|
211
|
+
readonly CONFIG_ERROR: "CONFIG_ERROR";
|
|
212
|
+
/** Invalid game config */
|
|
213
|
+
readonly INVALID_GAME_CONFIG: "CONFIG_INVALID_GAME_CONFIG";
|
|
214
|
+
/** Invalid screen config */
|
|
215
|
+
readonly INVALID_SCREEN_CONFIG: "CONFIG_INVALID_SCREEN_CONFIG";
|
|
216
|
+
/** Invalid widget config */
|
|
217
|
+
readonly INVALID_WIDGET_CONFIG: "CONFIG_INVALID_WIDGET_CONFIG";
|
|
218
|
+
/** Missing required config */
|
|
219
|
+
readonly MISSING_REQUIRED: "CONFIG_MISSING_REQUIRED";
|
|
220
|
+
/** Generic render error */
|
|
221
|
+
readonly RENDER_ERROR: "RENDER_ERROR";
|
|
222
|
+
/** Buffer not initialized */
|
|
223
|
+
readonly BUFFER_NOT_INITIALIZED: "RENDER_BUFFER_NOT_INITIALIZED";
|
|
224
|
+
/** Invalid cell coordinates */
|
|
225
|
+
readonly INVALID_COORDINATES: "RENDER_INVALID_COORDINATES";
|
|
226
|
+
/** Screen buffer overflow */
|
|
227
|
+
readonly BUFFER_OVERFLOW: "RENDER_BUFFER_OVERFLOW";
|
|
228
|
+
/** Render cycle timeout */
|
|
229
|
+
readonly CYCLE_TIMEOUT: "RENDER_CYCLE_TIMEOUT";
|
|
230
|
+
/** Generic input error */
|
|
231
|
+
readonly INPUT_ERROR: "INPUT_ERROR";
|
|
232
|
+
/** Invalid key sequence */
|
|
233
|
+
readonly INVALID_KEY_SEQUENCE: "INPUT_INVALID_KEY_SEQUENCE";
|
|
234
|
+
/** Invalid mouse event */
|
|
235
|
+
readonly INVALID_MOUSE_EVENT: "INPUT_INVALID_MOUSE_EVENT";
|
|
236
|
+
/** Input handler not registered */
|
|
237
|
+
readonly HANDLER_NOT_REGISTERED: "INPUT_HANDLER_NOT_REGISTERED";
|
|
238
|
+
/** Generic component error */
|
|
239
|
+
readonly COMPONENT_ERROR: "COMPONENT_ERROR";
|
|
240
|
+
/** Component not found on entity */
|
|
241
|
+
readonly NOT_FOUND: "COMPONENT_NOT_FOUND";
|
|
242
|
+
/** Component already exists on entity */
|
|
243
|
+
readonly ALREADY_EXISTS: "COMPONENT_ALREADY_EXISTS";
|
|
244
|
+
/** Invalid component data */
|
|
245
|
+
readonly INVALID_DATA: "COMPONENT_INVALID_DATA";
|
|
246
|
+
/** Component store not initialized */
|
|
247
|
+
readonly STORE_NOT_INITIALIZED: "COMPONENT_STORE_NOT_INITIALIZED";
|
|
248
|
+
/** Generic entity error */
|
|
249
|
+
readonly ENTITY_ERROR: "ENTITY_ERROR";
|
|
250
|
+
/** Screen entity already exists */
|
|
251
|
+
readonly SCREEN_ALREADY_EXISTS: "ENTITY_SCREEN_ALREADY_EXISTS";
|
|
252
|
+
/** Invalid entity ID */
|
|
253
|
+
readonly INVALID_ID: "ENTITY_INVALID_ID";
|
|
254
|
+
/** Entity missing required component */
|
|
255
|
+
readonly MISSING_COMPONENT: "ENTITY_MISSING_COMPONENT";
|
|
256
|
+
/** Entity hierarchy error */
|
|
257
|
+
readonly HIERARCHY_ERROR: "ENTITY_HIERARCHY_ERROR";
|
|
258
|
+
/** Generic system error */
|
|
259
|
+
readonly SYSTEM_ERROR: "SYSTEM_ERROR";
|
|
260
|
+
/** Game loop already running */
|
|
261
|
+
readonly LOOP_ALREADY_RUNNING: "SYSTEM_LOOP_ALREADY_RUNNING";
|
|
262
|
+
/** Game loop not running */
|
|
263
|
+
readonly LOOP_NOT_RUNNING: "SYSTEM_LOOP_NOT_RUNNING";
|
|
264
|
+
/** Cannot change world while running */
|
|
265
|
+
readonly CANNOT_CHANGE_WORLD: "SYSTEM_CANNOT_CHANGE_WORLD";
|
|
266
|
+
/** System execution failed */
|
|
267
|
+
readonly SYSTEM_EXECUTION_FAILED: "SYSTEM_EXECUTION_FAILED";
|
|
268
|
+
/** Phase not found */
|
|
269
|
+
readonly PHASE_NOT_FOUND: "SYSTEM_PHASE_NOT_FOUND";
|
|
270
|
+
/** Phase already exists */
|
|
271
|
+
readonly PHASE_ALREADY_EXISTS: "SYSTEM_PHASE_ALREADY_EXISTS";
|
|
272
|
+
/** Invalid phase order */
|
|
273
|
+
readonly INVALID_PHASE_ORDER: "SYSTEM_INVALID_PHASE_ORDER";
|
|
274
|
+
/** Scheduler not initialized */
|
|
275
|
+
readonly SCHEDULER_NOT_INITIALIZED: "SYSTEM_SCHEDULER_NOT_INITIALIZED";
|
|
276
|
+
/** Generic terminal error */
|
|
277
|
+
readonly TERMINAL_ERROR: "TERMINAL_ERROR";
|
|
278
|
+
/** Terminal not initialized */
|
|
279
|
+
readonly NOT_INITIALIZED: "TERMINAL_NOT_INITIALIZED";
|
|
280
|
+
/** Terminal already initialized */
|
|
281
|
+
readonly ALREADY_INITIALIZED: "TERMINAL_ALREADY_INITIALIZED";
|
|
282
|
+
/** Terminfo file not found */
|
|
283
|
+
readonly TERMINFO_NOT_FOUND: "TERMINAL_TERMINFO_NOT_FOUND";
|
|
284
|
+
/** Capability negotiation not started */
|
|
285
|
+
readonly NEGOTIATION_NOT_STARTED: "TERMINAL_NEGOTIATION_NOT_STARTED";
|
|
286
|
+
/** Capability negotiation already started */
|
|
287
|
+
readonly NEGOTIATION_ALREADY_STARTED: "TERMINAL_NEGOTIATION_ALREADY_STARTED";
|
|
288
|
+
/** Capability not supported */
|
|
289
|
+
readonly CAPABILITY_NOT_SUPPORTED: "TERMINAL_CAPABILITY_NOT_SUPPORTED";
|
|
290
|
+
/** Terminal write failed */
|
|
291
|
+
readonly WRITE_FAILED: "TERMINAL_WRITE_FAILED";
|
|
292
|
+
/** Terminal read failed */
|
|
293
|
+
readonly READ_FAILED: "TERMINAL_READ_FAILED";
|
|
294
|
+
/** Terminal cleanup failed */
|
|
295
|
+
readonly CLEANUP_FAILED: "TERMINAL_CLEANUP_FAILED";
|
|
296
|
+
/** Generic validation failure */
|
|
297
|
+
readonly INVALID_INPUT: "VALIDATION_INVALID_INPUT";
|
|
298
|
+
/** Invalid hex color format */
|
|
299
|
+
readonly INVALID_HEX_COLOR: "VALIDATION_INVALID_HEX_COLOR";
|
|
300
|
+
/** Invalid hex color length */
|
|
301
|
+
readonly INVALID_HEX_LENGTH: "VALIDATION_INVALID_HEX_LENGTH";
|
|
302
|
+
/** Invalid color object */
|
|
303
|
+
readonly INVALID_COLOR_OBJECT: "VALIDATION_INVALID_COLOR_OBJECT";
|
|
304
|
+
/** Invalid color value */
|
|
305
|
+
readonly INVALID_COLOR_VALUE: "VALIDATION_INVALID_COLOR_VALUE";
|
|
306
|
+
/** Invalid palette index */
|
|
307
|
+
readonly INVALID_PALETTE_INDEX: "VALIDATION_INVALID_PALETTE_INDEX";
|
|
308
|
+
/** Invalid color cube index */
|
|
309
|
+
readonly INVALID_CUBE_INDEX: "VALIDATION_INVALID_CUBE_INDEX";
|
|
310
|
+
/** Invalid grayscale index */
|
|
311
|
+
readonly INVALID_GRAYSCALE_INDEX: "VALIDATION_INVALID_GRAYSCALE_INDEX";
|
|
312
|
+
/** Invalid dimension value */
|
|
313
|
+
readonly INVALID_DIMENSION: "VALIDATION_INVALID_DIMENSION";
|
|
314
|
+
/** Invalid buffer dimensions */
|
|
315
|
+
readonly INVALID_BUFFER_DIMENSIONS: "VALIDATION_INVALID_BUFFER_DIMENSIONS";
|
|
316
|
+
/** Invalid surrogate pair */
|
|
317
|
+
readonly INVALID_SURROGATE_PAIR: "VALIDATION_INVALID_SURROGATE_PAIR";
|
|
318
|
+
/** Schema validation failed */
|
|
319
|
+
readonly SCHEMA_VALIDATION_FAILED: "VALIDATION_SCHEMA_FAILED";
|
|
320
|
+
/** Required field missing */
|
|
321
|
+
readonly REQUIRED_FIELD_MISSING: "VALIDATION_REQUIRED_FIELD_MISSING";
|
|
322
|
+
/** Value out of range */
|
|
323
|
+
readonly VALUE_OUT_OF_RANGE: "VALIDATION_VALUE_OUT_OF_RANGE";
|
|
324
|
+
};
|
|
325
|
+
type BlECSdErrorCodeType = ValidationErrorCodeType | TerminalErrorCodeType | SystemErrorCodeType | EntityErrorCodeType | ComponentErrorCodeType | InputErrorCodeType | RenderErrorCodeType | ConfigErrorCodeType | InternalErrorCodeType;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* BlECSd Error Type System
|
|
329
|
+
*
|
|
330
|
+
* Provides a discriminated union type system for all library errors.
|
|
331
|
+
* Uses plain data objects and factory functions per FP requirements.
|
|
332
|
+
*
|
|
333
|
+
* @module errors/types
|
|
334
|
+
*/
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Discriminated error kinds for BlECSd errors.
|
|
338
|
+
*/
|
|
339
|
+
type BlECSdErrorKind = 'validation' | 'terminal' | 'system' | 'entity' | 'component' | 'input' | 'render' | 'config' | 'internal';
|
|
340
|
+
/**
|
|
341
|
+
* Context data that can be attached to any error.
|
|
342
|
+
*/
|
|
343
|
+
interface ErrorContext {
|
|
344
|
+
/** The entity ID involved (if applicable) */
|
|
345
|
+
readonly entityId?: number;
|
|
346
|
+
/** The component name involved (if applicable) */
|
|
347
|
+
readonly componentName?: string;
|
|
348
|
+
/** The system name involved (if applicable) */
|
|
349
|
+
readonly systemName?: string;
|
|
350
|
+
/** The file path involved (if applicable) */
|
|
351
|
+
readonly filePath?: string;
|
|
352
|
+
/** The function name where error occurred */
|
|
353
|
+
readonly functionName?: string;
|
|
354
|
+
/** Additional data for debugging */
|
|
355
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
356
|
+
/** Zod validation issues (for validation errors) */
|
|
357
|
+
readonly zodIssues?: readonly core.$ZodIssue[];
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Base error data common to all BlECSd errors.
|
|
361
|
+
*/
|
|
362
|
+
interface BlECSdErrorBase<K extends BlECSdErrorKind, C extends BlECSdErrorCodeType> {
|
|
363
|
+
/** Discriminant for error kind */
|
|
364
|
+
readonly kind: K;
|
|
365
|
+
/** Error code for programmatic handling */
|
|
366
|
+
readonly code: C;
|
|
367
|
+
/** Human-readable error message */
|
|
368
|
+
readonly message: string;
|
|
369
|
+
/** Timestamp when error was created */
|
|
370
|
+
readonly timestamp: number;
|
|
371
|
+
/** Original cause (if wrapping another error) */
|
|
372
|
+
readonly cause?: Error;
|
|
373
|
+
/** Additional context for debugging */
|
|
374
|
+
readonly context?: ErrorContext;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Validation error for input/config validation failures.
|
|
378
|
+
*/
|
|
379
|
+
interface ValidationError extends BlECSdErrorBase<'validation', ValidationErrorCodeType> {
|
|
380
|
+
readonly kind: 'validation';
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Terminal error for terminal I/O and capability failures.
|
|
384
|
+
*/
|
|
385
|
+
interface TerminalError extends BlECSdErrorBase<'terminal', TerminalErrorCodeType> {
|
|
386
|
+
readonly kind: 'terminal';
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* System error for ECS system and game loop failures.
|
|
390
|
+
*/
|
|
391
|
+
interface SystemError extends BlECSdErrorBase<'system', SystemErrorCodeType> {
|
|
392
|
+
readonly kind: 'system';
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Entity error for ECS entity management failures.
|
|
396
|
+
*/
|
|
397
|
+
interface EntityError extends BlECSdErrorBase<'entity', EntityErrorCodeType> {
|
|
398
|
+
readonly kind: 'entity';
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Component error for ECS component failures.
|
|
402
|
+
*/
|
|
403
|
+
interface ComponentError extends BlECSdErrorBase<'component', ComponentErrorCodeType> {
|
|
404
|
+
readonly kind: 'component';
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Input error for input handling failures.
|
|
408
|
+
*/
|
|
409
|
+
interface InputError extends BlECSdErrorBase<'input', InputErrorCodeType> {
|
|
410
|
+
readonly kind: 'input';
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Render error for rendering failures.
|
|
414
|
+
*/
|
|
415
|
+
interface RenderError extends BlECSdErrorBase<'render', RenderErrorCodeType> {
|
|
416
|
+
readonly kind: 'render';
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Config error for configuration failures.
|
|
420
|
+
*/
|
|
421
|
+
interface ConfigError extends BlECSdErrorBase<'config', ConfigErrorCodeType> {
|
|
422
|
+
readonly kind: 'config';
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Internal error for library internal failures.
|
|
426
|
+
* These indicate bugs in the library itself.
|
|
427
|
+
*/
|
|
428
|
+
interface InternalError extends BlECSdErrorBase<'internal', InternalErrorCodeType> {
|
|
429
|
+
readonly kind: 'internal';
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Union of all BlECSd error types.
|
|
433
|
+
* Use type guards to narrow to specific error types.
|
|
434
|
+
*/
|
|
435
|
+
type BlECSdError = ValidationError | TerminalError | SystemError | EntityError | ComponentError | InputError | RenderError | ConfigError | InternalError;
|
|
436
|
+
/**
|
|
437
|
+
* Symbol used to attach BlECSdError data to native Error instances.
|
|
438
|
+
*/
|
|
439
|
+
declare const BLECSD_ERROR_SYMBOL: unique symbol;
|
|
440
|
+
/**
|
|
441
|
+
* Native Error with attached BlECSdError data.
|
|
442
|
+
* Used for throw/catch interop with native try/catch.
|
|
443
|
+
*/
|
|
444
|
+
interface NativeBlECSdError extends Error {
|
|
445
|
+
readonly [BLECSD_ERROR_SYMBOL]: BlECSdError;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Error Factory Functions
|
|
450
|
+
*
|
|
451
|
+
* Factory functions for creating BlECSd errors.
|
|
452
|
+
* All errors are immutable plain objects per FP requirements.
|
|
453
|
+
*
|
|
454
|
+
* @module errors/factories
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Options for creating errors.
|
|
459
|
+
*/
|
|
460
|
+
interface ErrorOptions {
|
|
461
|
+
/** Original cause (if wrapping another error) */
|
|
462
|
+
readonly cause?: Error;
|
|
463
|
+
/** Additional context for debugging */
|
|
464
|
+
readonly context?: ErrorContext;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Options for validation errors with Zod issues.
|
|
468
|
+
*/
|
|
469
|
+
interface ValidationErrorOptions extends ErrorOptions {
|
|
470
|
+
/** Zod validation issues */
|
|
471
|
+
readonly zodIssues?: readonly core.$ZodIssue[];
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Creates a validation error.
|
|
475
|
+
*
|
|
476
|
+
* @param code - The error code
|
|
477
|
+
* @param message - Human-readable error message
|
|
478
|
+
* @param options - Additional options
|
|
479
|
+
* @returns A ValidationError object
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```typescript
|
|
483
|
+
* import { createValidationError, ValidationErrorCode } from 'blecsd/errors';
|
|
484
|
+
*
|
|
485
|
+
* const error = createValidationError(
|
|
486
|
+
* ValidationErrorCode.INVALID_HEX_COLOR,
|
|
487
|
+
* 'Invalid hex color format: #xyz',
|
|
488
|
+
* { context: { data: { input: '#xyz' } } }
|
|
489
|
+
* );
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
declare function createValidationError(code: ValidationErrorCodeType, message: string, options?: ValidationErrorOptions): ValidationError;
|
|
493
|
+
/**
|
|
494
|
+
* Creates a terminal error.
|
|
495
|
+
*
|
|
496
|
+
* @param code - The error code
|
|
497
|
+
* @param message - Human-readable error message
|
|
498
|
+
* @param options - Additional options
|
|
499
|
+
* @returns A TerminalError object
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```typescript
|
|
503
|
+
* import { createTerminalError, TerminalErrorCode } from 'blecsd/errors';
|
|
504
|
+
*
|
|
505
|
+
* const error = createTerminalError(
|
|
506
|
+
* TerminalErrorCode.TERMINFO_NOT_FOUND,
|
|
507
|
+
* 'Terminfo file not found for terminal: xterm-256color'
|
|
508
|
+
* );
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
declare function createTerminalError(code: TerminalErrorCodeType, message: string, options?: ErrorOptions): TerminalError;
|
|
512
|
+
/**
|
|
513
|
+
* Creates a system error.
|
|
514
|
+
*
|
|
515
|
+
* @param code - The error code
|
|
516
|
+
* @param message - Human-readable error message
|
|
517
|
+
* @param options - Additional options
|
|
518
|
+
* @returns A SystemError object
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```typescript
|
|
522
|
+
* import { createSystemError, SystemErrorCode } from 'blecsd/errors';
|
|
523
|
+
*
|
|
524
|
+
* const error = createSystemError(
|
|
525
|
+
* SystemErrorCode.LOOP_ALREADY_RUNNING,
|
|
526
|
+
* 'Cannot start game loop: already running',
|
|
527
|
+
* { context: { systemName: 'GameLoop' } }
|
|
528
|
+
* );
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
declare function createSystemError(code: SystemErrorCodeType, message: string, options?: ErrorOptions): SystemError;
|
|
532
|
+
/**
|
|
533
|
+
* Creates an entity error.
|
|
534
|
+
*
|
|
535
|
+
* @param code - The error code
|
|
536
|
+
* @param message - Human-readable error message
|
|
537
|
+
* @param options - Additional options
|
|
538
|
+
* @returns An EntityError object
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```typescript
|
|
542
|
+
* import { createEntityError, EntityErrorCode } from 'blecsd/errors';
|
|
543
|
+
*
|
|
544
|
+
* const error = createEntityError(
|
|
545
|
+
* EntityErrorCode.NOT_FOUND,
|
|
546
|
+
* 'Entity not found: 42',
|
|
547
|
+
* { context: { entityId: 42 } }
|
|
548
|
+
* );
|
|
549
|
+
* ```
|
|
550
|
+
*/
|
|
551
|
+
declare function createEntityError(code: EntityErrorCodeType, message: string, options?: ErrorOptions): EntityError;
|
|
552
|
+
/**
|
|
553
|
+
* Creates a component error.
|
|
554
|
+
*
|
|
555
|
+
* @param code - The error code
|
|
556
|
+
* @param message - Human-readable error message
|
|
557
|
+
* @param options - Additional options
|
|
558
|
+
* @returns A ComponentError object
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```typescript
|
|
562
|
+
* import { createComponentError, ComponentErrorCode } from 'blecsd/errors';
|
|
563
|
+
*
|
|
564
|
+
* const error = createComponentError(
|
|
565
|
+
* ComponentErrorCode.NOT_FOUND,
|
|
566
|
+
* 'Component Position not found on entity 42',
|
|
567
|
+
* { context: { entityId: 42, componentName: 'Position' } }
|
|
568
|
+
* );
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
declare function createComponentError(code: ComponentErrorCodeType, message: string, options?: ErrorOptions): ComponentError;
|
|
572
|
+
/**
|
|
573
|
+
* Creates an input error.
|
|
574
|
+
*
|
|
575
|
+
* @param code - The error code
|
|
576
|
+
* @param message - Human-readable error message
|
|
577
|
+
* @param options - Additional options
|
|
578
|
+
* @returns An InputError object
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* ```typescript
|
|
582
|
+
* import { createInputError, InputErrorCode } from 'blecsd/errors';
|
|
583
|
+
*
|
|
584
|
+
* const error = createInputError(
|
|
585
|
+
* InputErrorCode.INVALID_KEY_SEQUENCE,
|
|
586
|
+
* 'Unrecognized escape sequence'
|
|
587
|
+
* );
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
declare function createInputError(code: InputErrorCodeType, message: string, options?: ErrorOptions): InputError;
|
|
591
|
+
/**
|
|
592
|
+
* Creates a render error.
|
|
593
|
+
*
|
|
594
|
+
* @param code - The error code
|
|
595
|
+
* @param message - Human-readable error message
|
|
596
|
+
* @param options - Additional options
|
|
597
|
+
* @returns A RenderError object
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```typescript
|
|
601
|
+
* import { createRenderError, RenderErrorCode } from 'blecsd/errors';
|
|
602
|
+
*
|
|
603
|
+
* const error = createRenderError(
|
|
604
|
+
* RenderErrorCode.INVALID_COORDINATES,
|
|
605
|
+
* 'Cell coordinates out of bounds: (100, 50)',
|
|
606
|
+
* { context: { data: { x: 100, y: 50 } } }
|
|
607
|
+
* );
|
|
608
|
+
* ```
|
|
609
|
+
*/
|
|
610
|
+
declare function createRenderError(code: RenderErrorCodeType, message: string, options?: ErrorOptions): RenderError;
|
|
611
|
+
/**
|
|
612
|
+
* Creates a config error.
|
|
613
|
+
*
|
|
614
|
+
* @param code - The error code
|
|
615
|
+
* @param message - Human-readable error message
|
|
616
|
+
* @param options - Additional options
|
|
617
|
+
* @returns A ConfigError object
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* ```typescript
|
|
621
|
+
* import { createConfigError, ConfigErrorCode } from 'blecsd/errors';
|
|
622
|
+
*
|
|
623
|
+
* const error = createConfigError(
|
|
624
|
+
* ConfigErrorCode.INVALID_GAME_CONFIG,
|
|
625
|
+
* 'Invalid game configuration: width must be positive'
|
|
626
|
+
* );
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
declare function createConfigError(code: ConfigErrorCodeType, message: string, options?: ErrorOptions): ConfigError;
|
|
630
|
+
/**
|
|
631
|
+
* Creates an internal error.
|
|
632
|
+
*
|
|
633
|
+
* @param code - The error code
|
|
634
|
+
* @param message - Human-readable error message
|
|
635
|
+
* @param options - Additional options
|
|
636
|
+
* @returns An InternalError object
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```typescript
|
|
640
|
+
* import { createInternalError, InternalErrorCode } from 'blecsd/errors';
|
|
641
|
+
*
|
|
642
|
+
* const error = createInternalError(
|
|
643
|
+
* InternalErrorCode.ASSERTION_FAILED,
|
|
644
|
+
* 'Assertion failed: expected x > 0'
|
|
645
|
+
* );
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
declare function createInternalError(code: InternalErrorCodeType, message: string, options?: ErrorOptions): InternalError;
|
|
649
|
+
/**
|
|
650
|
+
* Converts a BlECSdError to a native Error for throw/catch.
|
|
651
|
+
*
|
|
652
|
+
* The returned Error has the BlECSdError attached via symbol,
|
|
653
|
+
* allowing recovery with `fromNativeError()`.
|
|
654
|
+
*
|
|
655
|
+
* @param error - The BlECSdError to convert
|
|
656
|
+
* @returns A native Error with the BlECSdError attached
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* import { createValidationError, toNativeError, ValidationErrorCode } from 'blecsd/errors';
|
|
661
|
+
*
|
|
662
|
+
* const blecsdError = createValidationError(
|
|
663
|
+
* ValidationErrorCode.INVALID_HEX_COLOR,
|
|
664
|
+
* 'Invalid hex color'
|
|
665
|
+
* );
|
|
666
|
+
* throw toNativeError(blecsdError);
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
declare function toNativeError(error: BlECSdError): NativeBlECSdError;
|
|
670
|
+
/**
|
|
671
|
+
* Extracts a BlECSdError from a native Error (if it was created with `toNativeError()`).
|
|
672
|
+
*
|
|
673
|
+
* @param error - The caught error (unknown type from catch block)
|
|
674
|
+
* @returns The BlECSdError if present, null otherwise
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```typescript
|
|
678
|
+
* import { fromNativeError } from 'blecsd/errors';
|
|
679
|
+
*
|
|
680
|
+
* try {
|
|
681
|
+
* someFunction();
|
|
682
|
+
* } catch (e) {
|
|
683
|
+
* const blecsdError = fromNativeError(e);
|
|
684
|
+
* if (blecsdError) {
|
|
685
|
+
* console.log('BlECSd error:', blecsdError.code);
|
|
686
|
+
* } else {
|
|
687
|
+
* console.log('Unknown error:', e);
|
|
688
|
+
* }
|
|
689
|
+
* }
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
declare function fromNativeError(error: unknown): BlECSdError | null;
|
|
693
|
+
/**
|
|
694
|
+
* Wraps an unknown error as a BlECSdError.
|
|
695
|
+
*
|
|
696
|
+
* If the error is already a BlECSdError (via toNativeError), returns it.
|
|
697
|
+
* Otherwise, wraps it in an InternalError.
|
|
698
|
+
*
|
|
699
|
+
* @param error - The unknown error
|
|
700
|
+
* @param fallbackCode - Error code to use if not a BlECSdError
|
|
701
|
+
* @param fallbackMessage - Message prefix to use if not a BlECSdError
|
|
702
|
+
* @returns A BlECSdError
|
|
703
|
+
*
|
|
704
|
+
* @example
|
|
705
|
+
* ```typescript
|
|
706
|
+
* import { wrapError, InternalErrorCode } from 'blecsd/errors';
|
|
707
|
+
*
|
|
708
|
+
* try {
|
|
709
|
+
* riskyOperation();
|
|
710
|
+
* } catch (e) {
|
|
711
|
+
* const error = wrapError(
|
|
712
|
+
* e,
|
|
713
|
+
* InternalErrorCode.UNEXPECTED_STATE,
|
|
714
|
+
* 'Unexpected error in riskyOperation'
|
|
715
|
+
* );
|
|
716
|
+
* // error is always a BlECSdError
|
|
717
|
+
* }
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
declare function wrapError(error: unknown, fallbackCode: InternalErrorCodeType, fallbackMessage: string): BlECSdError;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Type Guards for BlECSd Errors
|
|
724
|
+
*
|
|
725
|
+
* Type guards for narrowing BlECSdError union types.
|
|
726
|
+
*
|
|
727
|
+
* @module errors/guards
|
|
728
|
+
*/
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Checks if an error is a ValidationError.
|
|
732
|
+
*
|
|
733
|
+
* @param error - The error to check
|
|
734
|
+
* @returns True if the error is a ValidationError
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* ```typescript
|
|
738
|
+
* import { isValidationError } from 'blecsd/errors';
|
|
739
|
+
*
|
|
740
|
+
* if (isValidationError(error)) {
|
|
741
|
+
* // error is narrowed to ValidationError
|
|
742
|
+
* console.log(error.context?.zodIssues);
|
|
743
|
+
* }
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
declare function isValidationError(error: BlECSdError): error is ValidationError;
|
|
747
|
+
/**
|
|
748
|
+
* Checks if an error is a TerminalError.
|
|
749
|
+
*
|
|
750
|
+
* @param error - The error to check
|
|
751
|
+
* @returns True if the error is a TerminalError
|
|
752
|
+
*/
|
|
753
|
+
declare function isTerminalError(error: BlECSdError): error is TerminalError;
|
|
754
|
+
/**
|
|
755
|
+
* Checks if an error is a SystemError.
|
|
756
|
+
*
|
|
757
|
+
* @param error - The error to check
|
|
758
|
+
* @returns True if the error is a SystemError
|
|
759
|
+
*/
|
|
760
|
+
declare function isSystemError(error: BlECSdError): error is SystemError;
|
|
761
|
+
/**
|
|
762
|
+
* Checks if an error is an EntityError.
|
|
763
|
+
*
|
|
764
|
+
* @param error - The error to check
|
|
765
|
+
* @returns True if the error is an EntityError
|
|
766
|
+
*/
|
|
767
|
+
declare function isEntityError(error: BlECSdError): error is EntityError;
|
|
768
|
+
/**
|
|
769
|
+
* Checks if an error is a ComponentError.
|
|
770
|
+
*
|
|
771
|
+
* @param error - The error to check
|
|
772
|
+
* @returns True if the error is a ComponentError
|
|
773
|
+
*/
|
|
774
|
+
declare function isComponentError(error: BlECSdError): error is ComponentError;
|
|
775
|
+
/**
|
|
776
|
+
* Checks if an error is an InputError.
|
|
777
|
+
*
|
|
778
|
+
* @param error - The error to check
|
|
779
|
+
* @returns True if the error is an InputError
|
|
780
|
+
*/
|
|
781
|
+
declare function isInputError(error: BlECSdError): error is InputError;
|
|
782
|
+
/**
|
|
783
|
+
* Checks if an error is a RenderError.
|
|
784
|
+
*
|
|
785
|
+
* @param error - The error to check
|
|
786
|
+
* @returns True if the error is a RenderError
|
|
787
|
+
*/
|
|
788
|
+
declare function isRenderError(error: BlECSdError): error is RenderError;
|
|
789
|
+
/**
|
|
790
|
+
* Checks if an error is a ConfigError.
|
|
791
|
+
*
|
|
792
|
+
* @param error - The error to check
|
|
793
|
+
* @returns True if the error is a ConfigError
|
|
794
|
+
*/
|
|
795
|
+
declare function isConfigError(error: BlECSdError): error is ConfigError;
|
|
796
|
+
/**
|
|
797
|
+
* Checks if an error is an InternalError.
|
|
798
|
+
*
|
|
799
|
+
* @param error - The error to check
|
|
800
|
+
* @returns True if the error is an InternalError
|
|
801
|
+
*/
|
|
802
|
+
declare function isInternalError(error: BlECSdError): error is InternalError;
|
|
803
|
+
/**
|
|
804
|
+
* Checks if an error is of a specific kind.
|
|
805
|
+
*
|
|
806
|
+
* @param error - The error to check
|
|
807
|
+
* @param kind - The kind to check for
|
|
808
|
+
* @returns True if the error is of the specified kind
|
|
809
|
+
*
|
|
810
|
+
* @example
|
|
811
|
+
* ```typescript
|
|
812
|
+
* import { isErrorKind } from 'blecsd/errors';
|
|
813
|
+
*
|
|
814
|
+
* if (isErrorKind(error, 'validation')) {
|
|
815
|
+
* // error is narrowed to ValidationError
|
|
816
|
+
* }
|
|
817
|
+
* ```
|
|
818
|
+
*/
|
|
819
|
+
declare function isErrorKind<K extends BlECSdErrorKind>(error: BlECSdError, kind: K): error is Extract<BlECSdError, {
|
|
820
|
+
kind: K;
|
|
821
|
+
}>;
|
|
822
|
+
/**
|
|
823
|
+
* Checks if an error has a specific code.
|
|
824
|
+
*
|
|
825
|
+
* @param error - The error to check
|
|
826
|
+
* @param code - The code to check for
|
|
827
|
+
* @returns True if the error has the specified code
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* ```typescript
|
|
831
|
+
* import { hasErrorCode, ValidationErrorCode } from 'blecsd/errors';
|
|
832
|
+
*
|
|
833
|
+
* if (hasErrorCode(error, ValidationErrorCode.INVALID_HEX_COLOR)) {
|
|
834
|
+
* // Handle specific error case
|
|
835
|
+
* }
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
declare function hasErrorCode(error: BlECSdError, code: string): boolean;
|
|
839
|
+
/**
|
|
840
|
+
* Checks if an unknown value is a BlECSdError (via NativeBlECSdError).
|
|
841
|
+
*
|
|
842
|
+
* @param value - The value to check
|
|
843
|
+
* @returns True if the value contains a BlECSdError
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* ```typescript
|
|
847
|
+
* import { isBlECSdError } from 'blecsd/errors';
|
|
848
|
+
*
|
|
849
|
+
* try {
|
|
850
|
+
* someFunction();
|
|
851
|
+
* } catch (e) {
|
|
852
|
+
* if (isBlECSdError(e)) {
|
|
853
|
+
* // e contains a BlECSdError
|
|
854
|
+
* }
|
|
855
|
+
* }
|
|
856
|
+
* ```
|
|
857
|
+
*/
|
|
858
|
+
declare function isBlECSdError(value: unknown): value is {
|
|
859
|
+
[BLECSD_ERROR_SYMBOL]: BlECSdError;
|
|
860
|
+
};
|
|
861
|
+
/**
|
|
862
|
+
* Checks if an unknown value looks like a BlECSdError object (duck typing).
|
|
863
|
+
*
|
|
864
|
+
* This checks the shape of the object rather than the symbol.
|
|
865
|
+
* Useful for deserializing errors or cross-realm scenarios.
|
|
866
|
+
*
|
|
867
|
+
* @param value - The value to check
|
|
868
|
+
* @returns True if the value has the shape of a BlECSdError
|
|
869
|
+
*/
|
|
870
|
+
declare function hasBlECSdErrorShape(value: unknown): value is BlECSdError;
|
|
871
|
+
/**
|
|
872
|
+
* Checks if an error has context data.
|
|
873
|
+
*
|
|
874
|
+
* @param error - The error to check
|
|
875
|
+
* @returns True if the error has context
|
|
876
|
+
*/
|
|
877
|
+
declare function hasContext(error: BlECSdError): error is BlECSdError & {
|
|
878
|
+
context: NonNullable<BlECSdError['context']>;
|
|
879
|
+
};
|
|
880
|
+
/**
|
|
881
|
+
* Checks if an error has a cause.
|
|
882
|
+
*
|
|
883
|
+
* @param error - The error to check
|
|
884
|
+
* @returns True if the error has a cause
|
|
885
|
+
*/
|
|
886
|
+
declare function hasCause(error: BlECSdError): error is BlECSdError & {
|
|
887
|
+
cause: Error;
|
|
888
|
+
};
|
|
889
|
+
/**
|
|
890
|
+
* Checks if an error has Zod issues in its context.
|
|
891
|
+
*
|
|
892
|
+
* @param error - The error to check
|
|
893
|
+
* @returns True if the error has Zod issues
|
|
894
|
+
*/
|
|
895
|
+
declare function hasZodIssues(error: BlECSdError): error is BlECSdError & {
|
|
896
|
+
context: NonNullable<BlECSdError['context']> & {
|
|
897
|
+
zodIssues: NonNullable<BlECSdError['context']>['zodIssues'];
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Result Type for Recoverable Operations
|
|
903
|
+
*
|
|
904
|
+
* A discriminated union type for representing success or failure.
|
|
905
|
+
* Inspired by Rust's Result<T, E> type.
|
|
906
|
+
*
|
|
907
|
+
* @module errors/result
|
|
908
|
+
*/
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Successful result containing a value.
|
|
912
|
+
*/
|
|
913
|
+
interface ResultOk<T> {
|
|
914
|
+
readonly ok: true;
|
|
915
|
+
readonly value: T;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Failed result containing an error.
|
|
919
|
+
*/
|
|
920
|
+
interface ResultErr<E> {
|
|
921
|
+
readonly ok: false;
|
|
922
|
+
readonly error: E;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Result type representing either success (Ok) or failure (Err).
|
|
926
|
+
*
|
|
927
|
+
* @typeParam T - The success value type
|
|
928
|
+
* @typeParam E - The error type (defaults to BlECSdError)
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* ```typescript
|
|
932
|
+
* import { Result, ok, err, unwrapOr } from 'blecsd/errors';
|
|
933
|
+
*
|
|
934
|
+
* function divide(a: number, b: number): Result<number, string> {
|
|
935
|
+
* if (b === 0) {
|
|
936
|
+
* return err('Division by zero');
|
|
937
|
+
* }
|
|
938
|
+
* return ok(a / b);
|
|
939
|
+
* }
|
|
940
|
+
*
|
|
941
|
+
* const result = divide(10, 2);
|
|
942
|
+
* const value = unwrapOr(result, 0); // 5
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
|
+
type Result<T, E = BlECSdError> = ResultOk<T> | ResultErr<E>;
|
|
946
|
+
/**
|
|
947
|
+
* Creates a successful Result containing a value.
|
|
948
|
+
*
|
|
949
|
+
* @param value - The success value
|
|
950
|
+
* @returns A Result with ok: true
|
|
951
|
+
*
|
|
952
|
+
* @example
|
|
953
|
+
* ```typescript
|
|
954
|
+
* import { ok } from 'blecsd/errors';
|
|
955
|
+
*
|
|
956
|
+
* const result = ok(42);
|
|
957
|
+
* // result: { ok: true, value: 42 }
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
declare function ok<T>(value: T): ResultOk<T>;
|
|
961
|
+
/**
|
|
962
|
+
* Creates a failed Result containing an error.
|
|
963
|
+
*
|
|
964
|
+
* @param error - The error value
|
|
965
|
+
* @returns A Result with ok: false
|
|
966
|
+
*
|
|
967
|
+
* @example
|
|
968
|
+
* ```typescript
|
|
969
|
+
* import { err, createValidationError, ValidationErrorCode } from 'blecsd/errors';
|
|
970
|
+
*
|
|
971
|
+
* const result = err(createValidationError(
|
|
972
|
+
* ValidationErrorCode.INVALID_INPUT,
|
|
973
|
+
* 'Invalid input'
|
|
974
|
+
* ));
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
declare function err<E>(error: E): ResultErr<E>;
|
|
978
|
+
/**
|
|
979
|
+
* Checks if a Result is Ok (successful).
|
|
980
|
+
*
|
|
981
|
+
* @param result - The Result to check
|
|
982
|
+
* @returns True if the Result is Ok
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* ```typescript
|
|
986
|
+
* import { isOk, ok, err } from 'blecsd/errors';
|
|
987
|
+
*
|
|
988
|
+
* isOk(ok(42)); // true
|
|
989
|
+
* isOk(err('error')); // false
|
|
990
|
+
* ```
|
|
991
|
+
*/
|
|
992
|
+
declare function isOk<T, E>(result: Result<T, E>): result is ResultOk<T>;
|
|
993
|
+
/**
|
|
994
|
+
* Checks if a Result is Err (failed).
|
|
995
|
+
*
|
|
996
|
+
* @param result - The Result to check
|
|
997
|
+
* @returns True if the Result is Err
|
|
998
|
+
*
|
|
999
|
+
* @example
|
|
1000
|
+
* ```typescript
|
|
1001
|
+
* import { isErr, ok, err } from 'blecsd/errors';
|
|
1002
|
+
*
|
|
1003
|
+
* isErr(ok(42)); // false
|
|
1004
|
+
* isErr(err('error')); // true
|
|
1005
|
+
* ```
|
|
1006
|
+
*/
|
|
1007
|
+
declare function isErr<T, E>(result: Result<T, E>): result is ResultErr<E>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Extracts the value from an Ok Result, or throws if Err.
|
|
1010
|
+
*
|
|
1011
|
+
* @param result - The Result to unwrap
|
|
1012
|
+
* @returns The success value
|
|
1013
|
+
* @throws Error if the Result is Err
|
|
1014
|
+
*
|
|
1015
|
+
* @example
|
|
1016
|
+
* ```typescript
|
|
1017
|
+
* import { unwrap, ok, err } from 'blecsd/errors';
|
|
1018
|
+
*
|
|
1019
|
+
* unwrap(ok(42)); // 42
|
|
1020
|
+
* unwrap(err('error')); // throws Error
|
|
1021
|
+
* ```
|
|
1022
|
+
*/
|
|
1023
|
+
declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
1024
|
+
/**
|
|
1025
|
+
* Extracts the value from an Ok Result, or returns a default value if Err.
|
|
1026
|
+
*
|
|
1027
|
+
* @param result - The Result to unwrap
|
|
1028
|
+
* @param defaultValue - The value to return if Err
|
|
1029
|
+
* @returns The success value or the default value
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* ```typescript
|
|
1033
|
+
* import { unwrapOr, ok, err } from 'blecsd/errors';
|
|
1034
|
+
*
|
|
1035
|
+
* unwrapOr(ok(42), 0); // 42
|
|
1036
|
+
* unwrapOr(err('error'), 0); // 0
|
|
1037
|
+
* ```
|
|
1038
|
+
*/
|
|
1039
|
+
declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
|
|
1040
|
+
/**
|
|
1041
|
+
* Extracts the value from an Ok Result, or computes a default value if Err.
|
|
1042
|
+
*
|
|
1043
|
+
* @param result - The Result to unwrap
|
|
1044
|
+
* @param fn - Function to compute the default value (receives the error)
|
|
1045
|
+
* @returns The success value or the computed default value
|
|
1046
|
+
*
|
|
1047
|
+
* @example
|
|
1048
|
+
* ```typescript
|
|
1049
|
+
* import { unwrapOrElse, ok, err } from 'blecsd/errors';
|
|
1050
|
+
*
|
|
1051
|
+
* unwrapOrElse(ok(42), () => 0); // 42
|
|
1052
|
+
* unwrapOrElse(err('error'), (e) => e.length); // 5
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
declare function unwrapOrElse<T, E>(result: Result<T, E>, fn: (error: E) => T): T;
|
|
1056
|
+
/**
|
|
1057
|
+
* Maps a function over the Ok value, leaving Err unchanged.
|
|
1058
|
+
*
|
|
1059
|
+
* @param result - The Result to map
|
|
1060
|
+
* @param fn - Function to apply to the Ok value
|
|
1061
|
+
* @returns A new Result with the mapped value
|
|
1062
|
+
*
|
|
1063
|
+
* @example
|
|
1064
|
+
* ```typescript
|
|
1065
|
+
* import { map, ok, err } from 'blecsd/errors';
|
|
1066
|
+
*
|
|
1067
|
+
* map(ok(42), (x) => x * 2); // ok(84)
|
|
1068
|
+
* map(err('error'), (x) => x * 2); // err('error')
|
|
1069
|
+
* ```
|
|
1070
|
+
*/
|
|
1071
|
+
declare function map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Maps a function over the Err error, leaving Ok unchanged.
|
|
1074
|
+
*
|
|
1075
|
+
* @param result - The Result to map
|
|
1076
|
+
* @param fn - Function to apply to the Err error
|
|
1077
|
+
* @returns A new Result with the mapped error
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```typescript
|
|
1081
|
+
* import { mapError, ok, err } from 'blecsd/errors';
|
|
1082
|
+
*
|
|
1083
|
+
* mapError(ok(42), (e) => new Error(e)); // ok(42)
|
|
1084
|
+
* mapError(err('oops'), (e) => new Error(e)); // err(Error('oops'))
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
1087
|
+
declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Chains Result-returning functions, short-circuiting on Err.
|
|
1090
|
+
*
|
|
1091
|
+
* @param result - The Result to chain
|
|
1092
|
+
* @param fn - Function that returns a Result
|
|
1093
|
+
* @returns The Result from the function, or the original Err
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* ```typescript
|
|
1097
|
+
* import { flatMap, ok, err, Result } from 'blecsd/errors';
|
|
1098
|
+
*
|
|
1099
|
+
* function sqrt(x: number): Result<number, string> {
|
|
1100
|
+
* return x >= 0 ? ok(Math.sqrt(x)) : err('negative number');
|
|
1101
|
+
* }
|
|
1102
|
+
*
|
|
1103
|
+
* flatMap(ok(16), sqrt); // ok(4)
|
|
1104
|
+
* flatMap(ok(-1), sqrt); // err('negative number')
|
|
1105
|
+
* flatMap(err('x'), sqrt); // err('x')
|
|
1106
|
+
* ```
|
|
1107
|
+
*/
|
|
1108
|
+
declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
|
|
1109
|
+
|
|
1110
|
+
export { BLECSD_ERROR_SYMBOL, type BlECSdError, type BlECSdErrorBase, BlECSdErrorCode, type BlECSdErrorCodeType, type BlECSdErrorKind, type ComponentError, ComponentErrorCode, type ComponentErrorCodeType, type ConfigError, ConfigErrorCode, type ConfigErrorCodeType, type EntityError, EntityErrorCode, type EntityErrorCodeType, type ErrorContext, type ErrorOptions, type InputError, InputErrorCode, type InputErrorCodeType, type InternalError, InternalErrorCode, type InternalErrorCodeType, type NativeBlECSdError, type RenderError, RenderErrorCode, type RenderErrorCodeType, type Result, type ResultErr, type ResultOk, type SystemError, SystemErrorCode, type SystemErrorCodeType, type TerminalError, TerminalErrorCode, type TerminalErrorCodeType, type ValidationError, ValidationErrorCode, type ValidationErrorCodeType, type ValidationErrorOptions, createComponentError, createConfigError, createEntityError, createInputError, createInternalError, createRenderError, createSystemError, createTerminalError, createValidationError, err, flatMap, fromNativeError, hasBlECSdErrorShape, hasCause, hasContext, hasErrorCode, hasZodIssues, isBlECSdError, isComponentError, isConfigError, isEntityError, isErr, isErrorKind, isInputError, isInternalError, isOk, isRenderError, isSystemError, isTerminalError, isValidationError, map, mapError, ok, toNativeError, unwrap, unwrapOr, unwrapOrElse, wrapError };
|