@dxos/errors 0.8.4-main.b97322e → 0.8.4-main.dedc0f3
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/dist/lib/browser/index.mjs +74 -17
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +74 -17
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/base.d.ts +13 -12
- package/dist/types/src/base.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +156 -144
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/errors.test.ts +5 -0
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
// src/base.ts
|
|
2
|
+
function _check_private_redeclaration(obj, privateCollection) {
|
|
3
|
+
if (privateCollection.has(obj)) {
|
|
4
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function _class_apply_descriptor_get(receiver, descriptor) {
|
|
8
|
+
if (descriptor.get) {
|
|
9
|
+
return descriptor.get.call(receiver);
|
|
10
|
+
}
|
|
11
|
+
return descriptor.value;
|
|
12
|
+
}
|
|
13
|
+
function _class_apply_descriptor_set(receiver, descriptor, value) {
|
|
14
|
+
if (descriptor.set) {
|
|
15
|
+
descriptor.set.call(receiver, value);
|
|
16
|
+
} else {
|
|
17
|
+
if (!descriptor.writable) {
|
|
18
|
+
throw new TypeError("attempted to set read only private field");
|
|
19
|
+
}
|
|
20
|
+
descriptor.value = value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _class_extract_field_descriptor(receiver, privateMap, action) {
|
|
24
|
+
if (!privateMap.has(receiver)) {
|
|
25
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
26
|
+
}
|
|
27
|
+
return privateMap.get(receiver);
|
|
28
|
+
}
|
|
29
|
+
function _class_private_field_get(receiver, privateMap) {
|
|
30
|
+
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
|
|
31
|
+
return _class_apply_descriptor_get(receiver, descriptor);
|
|
32
|
+
}
|
|
33
|
+
function _class_private_field_init(obj, privateMap, value) {
|
|
34
|
+
_check_private_redeclaration(obj, privateMap);
|
|
35
|
+
privateMap.set(obj, value);
|
|
36
|
+
}
|
|
37
|
+
function _class_private_field_set(receiver, privateMap, value) {
|
|
38
|
+
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
|
|
39
|
+
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function _define_property(obj, key, value) {
|
|
43
|
+
if (key in obj) {
|
|
44
|
+
Object.defineProperty(obj, key, {
|
|
45
|
+
value,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
obj[key] = value;
|
|
52
|
+
}
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
var _code = /* @__PURE__ */ new WeakMap();
|
|
56
|
+
var _context = /* @__PURE__ */ new WeakMap();
|
|
2
57
|
var BaseError = class _BaseError extends Error {
|
|
3
58
|
/**
|
|
4
59
|
* Primary way of defining new error classes.
|
|
@@ -10,10 +65,8 @@ var BaseError = class _BaseError extends Error {
|
|
|
10
65
|
* ```
|
|
11
66
|
*/
|
|
12
67
|
static extend(code) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.code = code;
|
|
16
|
-
}
|
|
68
|
+
var _class;
|
|
69
|
+
return _class = class extends _BaseError {
|
|
17
70
|
static is(error) {
|
|
18
71
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
19
72
|
}
|
|
@@ -26,28 +79,32 @@ var BaseError = class _BaseError extends Error {
|
|
|
26
79
|
constructor(message, options) {
|
|
27
80
|
super(code, message, options);
|
|
28
81
|
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
#code;
|
|
32
|
-
#context;
|
|
33
|
-
constructor(code, message, options) {
|
|
34
|
-
super(message, options);
|
|
35
|
-
this.#code = code;
|
|
36
|
-
this.#context = options?.context ?? {};
|
|
37
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
82
|
+
}, _define_property(_class, "code", code), _class;
|
|
38
83
|
}
|
|
39
84
|
get name() {
|
|
40
|
-
return this
|
|
85
|
+
return _class_private_field_get(this, _code);
|
|
41
86
|
}
|
|
42
87
|
get code() {
|
|
43
|
-
return this
|
|
88
|
+
return _class_private_field_get(this, _code);
|
|
44
89
|
}
|
|
45
90
|
// For effect error matching.
|
|
46
91
|
get _tag() {
|
|
47
|
-
return this
|
|
92
|
+
return _class_private_field_get(this, _code);
|
|
48
93
|
}
|
|
49
94
|
get context() {
|
|
50
|
-
return this
|
|
95
|
+
return _class_private_field_get(this, _context);
|
|
96
|
+
}
|
|
97
|
+
constructor(code, message, options) {
|
|
98
|
+
super(message, options), _class_private_field_init(this, _code, {
|
|
99
|
+
writable: true,
|
|
100
|
+
value: void 0
|
|
101
|
+
}), _class_private_field_init(this, _context, {
|
|
102
|
+
writable: true,
|
|
103
|
+
value: void 0
|
|
104
|
+
});
|
|
105
|
+
_class_private_field_set(this, _code, code);
|
|
106
|
+
_class_private_field_set(this, _context, options?.context ?? {});
|
|
107
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
51
108
|
}
|
|
52
109
|
};
|
|
53
110
|
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/base.ts", "../../../src/errors.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport type BaseErrorOptions = {\n /**\n * The cause of the error.\n * An instance of Error.\n */\n cause?: unknown;\n\n /**\n * Structured details about the error.\n */\n context?: Record<string, unknown>;\n};\n\n/**\n * Base class for all DXOS errors.\n */\nexport class BaseError<Code extends string = string> extends Error {\n /**\n * Primary way of defining new error classes.\n *\n * Expample:\n *\n * ```ts\n * export class AiInputPreprocessingError extends BaseError.extend('AI_INPUT_PREPROCESSING_ERROR') {}\n * ```\n */\n static extend<Code extends string>(code: Code) {\n return class extends BaseError<Code> {\n static code = code;\n\n static is(error: unknown): error is BaseError {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === code;\n }\n\n static wrap(message: string, options?: Omit<BaseErrorOptions, 'cause'>) {\n return (error: unknown) => new this(message, { ...options, cause: error });\n }\n\n constructor(message: string, options?: BaseErrorOptions) {\n super(code, message, options);\n }\n };\n }\n\n #code: Code;\n #context: Record<string, unknown>;\n\n constructor(code: Code, message: string, options?: BaseErrorOptions) {\n super(message, options);\n\n this.#code = code;\n this.#context = options?.context ?? {};\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n override get name() {\n return this.#code;\n }\n\n get code(): Code {\n return this.#code;\n }\n\n // For effect error matching.\n get _tag(): Code {\n return this.#code;\n }\n\n get context() {\n return this.#context;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError } from './base';\n\nexport class TimeoutError extends BaseError.extend('TIMEOUT') {}\n\nexport class AbortedError extends BaseError.extend('ABORTED') {}\n\nexport class UnimplementedError extends BaseError.extend('UNIMPLEMENTED') {}\n\nexport class ApiError extends BaseError.extend('API_ERROR') {}\n\nexport class SystemError extends BaseError.extend('SYSTEM_ERROR') {}\n\nexport class InternalError extends BaseError.extend('INTERNAL_ERROR') {}\n"],
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": ["BaseError", "Error", "extend", "code", "is", "error", "wrap", "message", "options", "cause", "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgDE,QAAA,oBAAA,QAAA;IACA,WAAA,oBAAA,QAAA;AA7BK,IAAMA,YAAN,MAAMA,mBAAgDC,MAAAA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AAUC,OAAO,gBAAA,EAAA;AAAmB;",
|
|
6
|
+
"names": ["BaseError", "Error", "extend", "code", "is", "error", "wrap", "message", "options", "cause", "name", "_tag", "context", "Object", "setPrototypeOf", "prototype", "TimeoutError", "BaseError", "extend", "AbortedError", "UnimplementedError", "ApiError", "SystemError", "InternalError"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/base.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/base.ts":{"bytes":7660,"imports":[],"format":"esm"},"src/errors.ts":{"bytes":2000,"imports":[{"path":"src/base.ts","kind":"import-statement","original":"./base"}],"format":"esm"},"src/index.ts":{"bytes":523,"imports":[{"path":"src/base.ts","kind":"import-statement","original":"./base"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3885},"dist/lib/browser/index.mjs":{"imports":[],"exports":["AbortedError","ApiError","BaseError","InternalError","SystemError","TimeoutError","UnimplementedError"],"entryPoint":"src/index.ts","inputs":{"src/base.ts":{"bytesInOutput":3300},"src/index.ts":{"bytesInOutput":0},"src/errors.ts":{"bytesInOutput":418}},"bytes":3908}}}
|
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/base.ts
|
|
4
|
+
function _check_private_redeclaration(obj, privateCollection) {
|
|
5
|
+
if (privateCollection.has(obj)) {
|
|
6
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function _class_apply_descriptor_get(receiver, descriptor) {
|
|
10
|
+
if (descriptor.get) {
|
|
11
|
+
return descriptor.get.call(receiver);
|
|
12
|
+
}
|
|
13
|
+
return descriptor.value;
|
|
14
|
+
}
|
|
15
|
+
function _class_apply_descriptor_set(receiver, descriptor, value) {
|
|
16
|
+
if (descriptor.set) {
|
|
17
|
+
descriptor.set.call(receiver, value);
|
|
18
|
+
} else {
|
|
19
|
+
if (!descriptor.writable) {
|
|
20
|
+
throw new TypeError("attempted to set read only private field");
|
|
21
|
+
}
|
|
22
|
+
descriptor.value = value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function _class_extract_field_descriptor(receiver, privateMap, action) {
|
|
26
|
+
if (!privateMap.has(receiver)) {
|
|
27
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
28
|
+
}
|
|
29
|
+
return privateMap.get(receiver);
|
|
30
|
+
}
|
|
31
|
+
function _class_private_field_get(receiver, privateMap) {
|
|
32
|
+
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
|
|
33
|
+
return _class_apply_descriptor_get(receiver, descriptor);
|
|
34
|
+
}
|
|
35
|
+
function _class_private_field_init(obj, privateMap, value) {
|
|
36
|
+
_check_private_redeclaration(obj, privateMap);
|
|
37
|
+
privateMap.set(obj, value);
|
|
38
|
+
}
|
|
39
|
+
function _class_private_field_set(receiver, privateMap, value) {
|
|
40
|
+
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
|
|
41
|
+
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function _define_property(obj, key, value) {
|
|
45
|
+
if (key in obj) {
|
|
46
|
+
Object.defineProperty(obj, key, {
|
|
47
|
+
value,
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
obj[key] = value;
|
|
54
|
+
}
|
|
55
|
+
return obj;
|
|
56
|
+
}
|
|
57
|
+
var _code = /* @__PURE__ */ new WeakMap();
|
|
58
|
+
var _context = /* @__PURE__ */ new WeakMap();
|
|
4
59
|
var BaseError = class _BaseError extends Error {
|
|
5
60
|
/**
|
|
6
61
|
* Primary way of defining new error classes.
|
|
@@ -12,10 +67,8 @@ var BaseError = class _BaseError extends Error {
|
|
|
12
67
|
* ```
|
|
13
68
|
*/
|
|
14
69
|
static extend(code) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.code = code;
|
|
18
|
-
}
|
|
70
|
+
var _class;
|
|
71
|
+
return _class = class extends _BaseError {
|
|
19
72
|
static is(error) {
|
|
20
73
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
21
74
|
}
|
|
@@ -28,28 +81,32 @@ var BaseError = class _BaseError extends Error {
|
|
|
28
81
|
constructor(message, options) {
|
|
29
82
|
super(code, message, options);
|
|
30
83
|
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
#code;
|
|
34
|
-
#context;
|
|
35
|
-
constructor(code, message, options) {
|
|
36
|
-
super(message, options);
|
|
37
|
-
this.#code = code;
|
|
38
|
-
this.#context = options?.context ?? {};
|
|
39
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
84
|
+
}, _define_property(_class, "code", code), _class;
|
|
40
85
|
}
|
|
41
86
|
get name() {
|
|
42
|
-
return this
|
|
87
|
+
return _class_private_field_get(this, _code);
|
|
43
88
|
}
|
|
44
89
|
get code() {
|
|
45
|
-
return this
|
|
90
|
+
return _class_private_field_get(this, _code);
|
|
46
91
|
}
|
|
47
92
|
// For effect error matching.
|
|
48
93
|
get _tag() {
|
|
49
|
-
return this
|
|
94
|
+
return _class_private_field_get(this, _code);
|
|
50
95
|
}
|
|
51
96
|
get context() {
|
|
52
|
-
return this
|
|
97
|
+
return _class_private_field_get(this, _context);
|
|
98
|
+
}
|
|
99
|
+
constructor(code, message, options) {
|
|
100
|
+
super(message, options), _class_private_field_init(this, _code, {
|
|
101
|
+
writable: true,
|
|
102
|
+
value: void 0
|
|
103
|
+
}), _class_private_field_init(this, _context, {
|
|
104
|
+
writable: true,
|
|
105
|
+
value: void 0
|
|
106
|
+
});
|
|
107
|
+
_class_private_field_set(this, _code, code);
|
|
108
|
+
_class_private_field_set(this, _context, options?.context ?? {});
|
|
109
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
53
110
|
}
|
|
54
111
|
};
|
|
55
112
|
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/base.ts", "../../../src/errors.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport type BaseErrorOptions = {\n /**\n * The cause of the error.\n * An instance of Error.\n */\n cause?: unknown;\n\n /**\n * Structured details about the error.\n */\n context?: Record<string, unknown>;\n};\n\n/**\n * Base class for all DXOS errors.\n */\nexport class BaseError<Code extends string = string> extends Error {\n /**\n * Primary way of defining new error classes.\n *\n * Expample:\n *\n * ```ts\n * export class AiInputPreprocessingError extends BaseError.extend('AI_INPUT_PREPROCESSING_ERROR') {}\n * ```\n */\n static extend<Code extends string>(code: Code) {\n return class extends BaseError<Code> {\n static code = code;\n\n static is(error: unknown): error is BaseError {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === code;\n }\n\n static wrap(message: string, options?: Omit<BaseErrorOptions, 'cause'>) {\n return (error: unknown) => new this(message, { ...options, cause: error });\n }\n\n constructor(message: string, options?: BaseErrorOptions) {\n super(code, message, options);\n }\n };\n }\n\n #code: Code;\n #context: Record<string, unknown>;\n\n constructor(code: Code, message: string, options?: BaseErrorOptions) {\n super(message, options);\n\n this.#code = code;\n this.#context = options?.context ?? {};\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n override get name() {\n return this.#code;\n }\n\n get code(): Code {\n return this.#code;\n }\n\n // For effect error matching.\n get _tag(): Code {\n return this.#code;\n }\n\n get context() {\n return this.#context;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError } from './base';\n\nexport class TimeoutError extends BaseError.extend('TIMEOUT') {}\n\nexport class AbortedError extends BaseError.extend('ABORTED') {}\n\nexport class UnimplementedError extends BaseError.extend('UNIMPLEMENTED') {}\n\nexport class ApiError extends BaseError.extend('API_ERROR') {}\n\nexport class SystemError extends BaseError.extend('SYSTEM_ERROR') {}\n\nexport class InternalError extends BaseError.extend('INTERNAL_ERROR') {}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["BaseError", "Error", "extend", "code", "is", "error", "wrap", "message", "options", "cause", "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgDE,QAAA,oBAAA,QAAA;IACA,WAAA,oBAAA,QAAA;AA7BK,IAAMA,YAAN,MAAMA,mBAAgDC,MAAAA;;;;;;;;;;EAU3D,OAAOC,OAA4BC,MAAY;;AAC7C,WAAA,SAAO,cAAcH,WAAAA;MAGnB,OAAOI,GAAGC,OAAoC;AAC5C,eAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQ,UAAUA,SAASA,MAAMF,SAASA;MAC1F;MAEA,OAAOG,KAAKC,SAAiBC,SAA2C;AACtE,eAAO,CAACH,UAAmB,IAAI,KAAKE,SAAS;UAAE,GAAGC;UAASC,OAAOJ;QAAM,CAAA;MAC1E;MAEA,YAAYE,SAAiBC,SAA4B;AACvD,cAAML,MAAMI,SAASC,OAAAA;MACvB;IACF,GAbE,iBAAA,QAAOL,QAAOA,IAAAA,GAAAA;EAclB;EAaA,IAAaO,OAAO;AAClB,WAAA,yBAAO,MAAK,KAAA;EACd;EAEA,IAAIP,OAAa;AACf,WAAA,yBAAO,MAAK,KAAA;EACd;;EAGA,IAAIQ,OAAa;AACf,WAAA,yBAAO,MAAK,KAAA;EACd;EAEA,IAAIC,UAAU;AACZ,WAAA,yBAAO,MAAK,QAAA;EACd;EAvBA,YAAYT,MAAYI,SAAiBC,SAA4B;AACnE,UAAMD,SAASC,OAAAA,GAJjB,0BAAA,MAAA,OAAA;;aAAA;QACA,0BAAA,MAAA,UAAA;;aAAA;;mCAKO,OAAQL,IAAAA;mCACR,UAAWK,SAASI,WAAW,CAAC,CAAA;AACrCC,WAAOC,eAAe,MAAM,WAAWC,SAAS;EAClD;AAkBF;;;ACrEO,IAAMC,eAAN,cAA2BC,UAAUC,OAAO,SAAA,EAAA;AAAY;AAExD,IAAMC,eAAN,cAA2BF,UAAUC,OAAO,SAAA,EAAA;AAAY;AAExD,IAAME,qBAAN,cAAiCH,UAAUC,OAAO,eAAA,EAAA;AAAkB;AAEpE,IAAMG,WAAN,cAAuBJ,UAAUC,OAAO,WAAA,EAAA;AAAc;AAEtD,IAAMI,cAAN,cAA0BL,UAAUC,OAAO,cAAA,EAAA;AAAiB;AAE5D,IAAMK,gBAAN,cAA4BN,UAAUC,OAAO,gBAAA,EAAA;AAAmB;",
|
|
6
|
+
"names": ["BaseError", "Error", "extend", "code", "is", "error", "wrap", "message", "options", "cause", "name", "_tag", "context", "Object", "setPrototypeOf", "prototype", "TimeoutError", "BaseError", "extend", "AbortedError", "UnimplementedError", "ApiError", "SystemError", "InternalError"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/base.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/base.ts":{"bytes":7660,"imports":[],"format":"esm"},"src/errors.ts":{"bytes":2000,"imports":[{"path":"src/base.ts","kind":"import-statement","original":"./base"}],"format":"esm"},"src/index.ts":{"bytes":523,"imports":[{"path":"src/base.ts","kind":"import-statement","original":"./base"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3887},"dist/lib/node-esm/index.mjs":{"imports":[],"exports":["AbortedError","ApiError","BaseError","InternalError","SystemError","TimeoutError","UnimplementedError"],"entryPoint":"src/index.ts","inputs":{"src/base.ts":{"bytesInOutput":3300},"src/index.ts":{"bytesInOutput":0},"src/errors.ts":{"bytesInOutput":418}},"bytes":4001}}}
|
package/dist/types/src/base.d.ts
CHANGED
|
@@ -25,12 +25,12 @@ export declare class BaseError<Code extends string = string> extends Error {
|
|
|
25
25
|
*/
|
|
26
26
|
static extend<Code extends string>(code: Code): {
|
|
27
27
|
new (message: string, options?: BaseErrorOptions): {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
#code: Code;
|
|
29
|
+
#context: Record<string, unknown>;
|
|
30
|
+
get name(): Code;
|
|
31
|
+
get code(): Code;
|
|
32
|
+
get _tag(): Code;
|
|
33
|
+
get context(): Record<string, unknown>;
|
|
34
34
|
message: string;
|
|
35
35
|
stack?: string;
|
|
36
36
|
cause?: unknown;
|
|
@@ -38,17 +38,18 @@ export declare class BaseError<Code extends string = string> extends Error {
|
|
|
38
38
|
code: Code;
|
|
39
39
|
is(error: unknown): error is BaseError;
|
|
40
40
|
wrap(message: string, options?: Omit<BaseErrorOptions, "cause">): (error: unknown) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
#code: Code;
|
|
42
|
+
#context: Record<string, unknown>;
|
|
43
|
+
get name(): Code;
|
|
44
|
+
get code(): Code;
|
|
45
|
+
get _tag(): Code;
|
|
46
|
+
get context(): Record<string, unknown>;
|
|
47
47
|
message: string;
|
|
48
48
|
stack?: string;
|
|
49
49
|
cause?: unknown;
|
|
50
50
|
};
|
|
51
51
|
extend<Code extends string>(code: Code): /*elided*/ any;
|
|
52
|
+
isError(error: unknown): error is Error;
|
|
52
53
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
53
54
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
54
55
|
stackTraceLimit: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/base.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,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