@atomicfinance/errors 3.4.7 → 3.5.1
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/index.d.ts +42 -152
- package/dist/index.js +37 -6
- package/dist/index.js.map +1 -1
- package/lib/index.js +64 -0
- package/lib/index.ts +46 -1
- package/package.json +1 -5
- package/CHANGELOG.md +0 -89
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
export declare class BaseError extends Error {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
constructor(msg?: string | Record<string, unknown>, props?: Record<string, unknown>);
|
|
5
|
+
}
|
|
2
6
|
export declare const StandardError: {
|
|
3
|
-
new (
|
|
4
|
-
[key: string]:
|
|
5
|
-
name: string;
|
|
6
|
-
message: string;
|
|
7
|
-
stack?: string;
|
|
8
|
-
};
|
|
9
|
-
new (props: any): {
|
|
10
|
-
[key: string]: any;
|
|
7
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
8
|
+
[key: string]: unknown;
|
|
11
9
|
name: string;
|
|
12
10
|
message: string;
|
|
13
11
|
stack?: string;
|
|
@@ -17,14 +15,8 @@ export declare const StandardError: {
|
|
|
17
15
|
stackTraceLimit: number;
|
|
18
16
|
};
|
|
19
17
|
export declare const ProviderNotFoundError: {
|
|
20
|
-
new (
|
|
21
|
-
[key: string]:
|
|
22
|
-
name: string;
|
|
23
|
-
message: string;
|
|
24
|
-
stack?: string;
|
|
25
|
-
};
|
|
26
|
-
new (props: any): {
|
|
27
|
-
[key: string]: any;
|
|
18
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
19
|
+
[key: string]: unknown;
|
|
28
20
|
name: string;
|
|
29
21
|
message: string;
|
|
30
22
|
stack?: string;
|
|
@@ -34,14 +26,8 @@ export declare const ProviderNotFoundError: {
|
|
|
34
26
|
stackTraceLimit: number;
|
|
35
27
|
};
|
|
36
28
|
export declare const InvalidProviderError: {
|
|
37
|
-
new (
|
|
38
|
-
[key: string]:
|
|
39
|
-
name: string;
|
|
40
|
-
message: string;
|
|
41
|
-
stack?: string;
|
|
42
|
-
};
|
|
43
|
-
new (props: any): {
|
|
44
|
-
[key: string]: any;
|
|
29
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
30
|
+
[key: string]: unknown;
|
|
45
31
|
name: string;
|
|
46
32
|
message: string;
|
|
47
33
|
stack?: string;
|
|
@@ -51,14 +37,8 @@ export declare const InvalidProviderError: {
|
|
|
51
37
|
stackTraceLimit: number;
|
|
52
38
|
};
|
|
53
39
|
export declare const DuplicateProviderError: {
|
|
54
|
-
new (
|
|
55
|
-
[key: string]:
|
|
56
|
-
name: string;
|
|
57
|
-
message: string;
|
|
58
|
-
stack?: string;
|
|
59
|
-
};
|
|
60
|
-
new (props: any): {
|
|
61
|
-
[key: string]: any;
|
|
40
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
41
|
+
[key: string]: unknown;
|
|
62
42
|
name: string;
|
|
63
43
|
message: string;
|
|
64
44
|
stack?: string;
|
|
@@ -68,14 +48,8 @@ export declare const DuplicateProviderError: {
|
|
|
68
48
|
stackTraceLimit: number;
|
|
69
49
|
};
|
|
70
50
|
export declare const NoProviderError: {
|
|
71
|
-
new (
|
|
72
|
-
[key: string]:
|
|
73
|
-
name: string;
|
|
74
|
-
message: string;
|
|
75
|
-
stack?: string;
|
|
76
|
-
};
|
|
77
|
-
new (props: any): {
|
|
78
|
-
[key: string]: any;
|
|
51
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
52
|
+
[key: string]: unknown;
|
|
79
53
|
name: string;
|
|
80
54
|
message: string;
|
|
81
55
|
stack?: string;
|
|
@@ -85,14 +59,8 @@ export declare const NoProviderError: {
|
|
|
85
59
|
stackTraceLimit: number;
|
|
86
60
|
};
|
|
87
61
|
export declare const UnsupportedMethodError: {
|
|
88
|
-
new (
|
|
89
|
-
[key: string]:
|
|
90
|
-
name: string;
|
|
91
|
-
message: string;
|
|
92
|
-
stack?: string;
|
|
93
|
-
};
|
|
94
|
-
new (props: any): {
|
|
95
|
-
[key: string]: any;
|
|
62
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
63
|
+
[key: string]: unknown;
|
|
96
64
|
name: string;
|
|
97
65
|
message: string;
|
|
98
66
|
stack?: string;
|
|
@@ -102,14 +70,8 @@ export declare const UnsupportedMethodError: {
|
|
|
102
70
|
stackTraceLimit: number;
|
|
103
71
|
};
|
|
104
72
|
export declare const UnimplementedMethodError: {
|
|
105
|
-
new (
|
|
106
|
-
[key: string]:
|
|
107
|
-
name: string;
|
|
108
|
-
message: string;
|
|
109
|
-
stack?: string;
|
|
110
|
-
};
|
|
111
|
-
new (props: any): {
|
|
112
|
-
[key: string]: any;
|
|
73
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
74
|
+
[key: string]: unknown;
|
|
113
75
|
name: string;
|
|
114
76
|
message: string;
|
|
115
77
|
stack?: string;
|
|
@@ -119,14 +81,8 @@ export declare const UnimplementedMethodError: {
|
|
|
119
81
|
stackTraceLimit: number;
|
|
120
82
|
};
|
|
121
83
|
export declare const InvalidProviderResponseError: {
|
|
122
|
-
new (
|
|
123
|
-
[key: string]:
|
|
124
|
-
name: string;
|
|
125
|
-
message: string;
|
|
126
|
-
stack?: string;
|
|
127
|
-
};
|
|
128
|
-
new (props: any): {
|
|
129
|
-
[key: string]: any;
|
|
84
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
85
|
+
[key: string]: unknown;
|
|
130
86
|
name: string;
|
|
131
87
|
message: string;
|
|
132
88
|
stack?: string;
|
|
@@ -136,14 +92,8 @@ export declare const InvalidProviderResponseError: {
|
|
|
136
92
|
stackTraceLimit: number;
|
|
137
93
|
};
|
|
138
94
|
export declare const PendingTxError: {
|
|
139
|
-
new (
|
|
140
|
-
[key: string]:
|
|
141
|
-
name: string;
|
|
142
|
-
message: string;
|
|
143
|
-
stack?: string;
|
|
144
|
-
};
|
|
145
|
-
new (props: any): {
|
|
146
|
-
[key: string]: any;
|
|
95
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
96
|
+
[key: string]: unknown;
|
|
147
97
|
name: string;
|
|
148
98
|
message: string;
|
|
149
99
|
stack?: string;
|
|
@@ -153,14 +103,8 @@ export declare const PendingTxError: {
|
|
|
153
103
|
stackTraceLimit: number;
|
|
154
104
|
};
|
|
155
105
|
export declare const TxNotFoundError: {
|
|
156
|
-
new (
|
|
157
|
-
[key: string]:
|
|
158
|
-
name: string;
|
|
159
|
-
message: string;
|
|
160
|
-
stack?: string;
|
|
161
|
-
};
|
|
162
|
-
new (props: any): {
|
|
163
|
-
[key: string]: any;
|
|
106
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
107
|
+
[key: string]: unknown;
|
|
164
108
|
name: string;
|
|
165
109
|
message: string;
|
|
166
110
|
stack?: string;
|
|
@@ -170,14 +114,8 @@ export declare const TxNotFoundError: {
|
|
|
170
114
|
stackTraceLimit: number;
|
|
171
115
|
};
|
|
172
116
|
export declare const TxFailedError: {
|
|
173
|
-
new (
|
|
174
|
-
[key: string]:
|
|
175
|
-
name: string;
|
|
176
|
-
message: string;
|
|
177
|
-
stack?: string;
|
|
178
|
-
};
|
|
179
|
-
new (props: any): {
|
|
180
|
-
[key: string]: any;
|
|
117
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
118
|
+
[key: string]: unknown;
|
|
181
119
|
name: string;
|
|
182
120
|
message: string;
|
|
183
121
|
stack?: string;
|
|
@@ -187,14 +125,8 @@ export declare const TxFailedError: {
|
|
|
187
125
|
stackTraceLimit: number;
|
|
188
126
|
};
|
|
189
127
|
export declare const BlockNotFoundError: {
|
|
190
|
-
new (
|
|
191
|
-
[key: string]:
|
|
192
|
-
name: string;
|
|
193
|
-
message: string;
|
|
194
|
-
stack?: string;
|
|
195
|
-
};
|
|
196
|
-
new (props: any): {
|
|
197
|
-
[key: string]: any;
|
|
128
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
129
|
+
[key: string]: unknown;
|
|
198
130
|
name: string;
|
|
199
131
|
message: string;
|
|
200
132
|
stack?: string;
|
|
@@ -204,14 +136,8 @@ export declare const BlockNotFoundError: {
|
|
|
204
136
|
stackTraceLimit: number;
|
|
205
137
|
};
|
|
206
138
|
export declare const InvalidDestinationAddressError: {
|
|
207
|
-
new (
|
|
208
|
-
[key: string]:
|
|
209
|
-
name: string;
|
|
210
|
-
message: string;
|
|
211
|
-
stack?: string;
|
|
212
|
-
};
|
|
213
|
-
new (props: any): {
|
|
214
|
-
[key: string]: any;
|
|
139
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
140
|
+
[key: string]: unknown;
|
|
215
141
|
name: string;
|
|
216
142
|
message: string;
|
|
217
143
|
stack?: string;
|
|
@@ -221,14 +147,8 @@ export declare const InvalidDestinationAddressError: {
|
|
|
221
147
|
stackTraceLimit: number;
|
|
222
148
|
};
|
|
223
149
|
export declare const WalletError: {
|
|
224
|
-
new (
|
|
225
|
-
[key: string]:
|
|
226
|
-
name: string;
|
|
227
|
-
message: string;
|
|
228
|
-
stack?: string;
|
|
229
|
-
};
|
|
230
|
-
new (props: any): {
|
|
231
|
-
[key: string]: any;
|
|
150
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
151
|
+
[key: string]: unknown;
|
|
232
152
|
name: string;
|
|
233
153
|
message: string;
|
|
234
154
|
stack?: string;
|
|
@@ -238,14 +158,8 @@ export declare const WalletError: {
|
|
|
238
158
|
stackTraceLimit: number;
|
|
239
159
|
};
|
|
240
160
|
export declare const NodeError: {
|
|
241
|
-
new (
|
|
242
|
-
[key: string]:
|
|
243
|
-
name: string;
|
|
244
|
-
message: string;
|
|
245
|
-
stack?: string;
|
|
246
|
-
};
|
|
247
|
-
new (props: any): {
|
|
248
|
-
[key: string]: any;
|
|
161
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
162
|
+
[key: string]: unknown;
|
|
249
163
|
name: string;
|
|
250
164
|
message: string;
|
|
251
165
|
stack?: string;
|
|
@@ -255,14 +169,8 @@ export declare const NodeError: {
|
|
|
255
169
|
stackTraceLimit: number;
|
|
256
170
|
};
|
|
257
171
|
export declare const InvalidSecretError: {
|
|
258
|
-
new (
|
|
259
|
-
[key: string]:
|
|
260
|
-
name: string;
|
|
261
|
-
message: string;
|
|
262
|
-
stack?: string;
|
|
263
|
-
};
|
|
264
|
-
new (props: any): {
|
|
265
|
-
[key: string]: any;
|
|
172
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
173
|
+
[key: string]: unknown;
|
|
266
174
|
name: string;
|
|
267
175
|
message: string;
|
|
268
176
|
stack?: string;
|
|
@@ -272,14 +180,8 @@ export declare const InvalidSecretError: {
|
|
|
272
180
|
stackTraceLimit: number;
|
|
273
181
|
};
|
|
274
182
|
export declare const InvalidAddressError: {
|
|
275
|
-
new (
|
|
276
|
-
[key: string]:
|
|
277
|
-
name: string;
|
|
278
|
-
message: string;
|
|
279
|
-
stack?: string;
|
|
280
|
-
};
|
|
281
|
-
new (props: any): {
|
|
282
|
-
[key: string]: any;
|
|
183
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
184
|
+
[key: string]: unknown;
|
|
283
185
|
name: string;
|
|
284
186
|
message: string;
|
|
285
187
|
stack?: string;
|
|
@@ -289,14 +191,8 @@ export declare const InvalidAddressError: {
|
|
|
289
191
|
stackTraceLimit: number;
|
|
290
192
|
};
|
|
291
193
|
export declare const InvalidExpirationError: {
|
|
292
|
-
new (
|
|
293
|
-
[key: string]:
|
|
294
|
-
name: string;
|
|
295
|
-
message: string;
|
|
296
|
-
stack?: string;
|
|
297
|
-
};
|
|
298
|
-
new (props: any): {
|
|
299
|
-
[key: string]: any;
|
|
194
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
195
|
+
[key: string]: unknown;
|
|
300
196
|
name: string;
|
|
301
197
|
message: string;
|
|
302
198
|
stack?: string;
|
|
@@ -306,14 +202,8 @@ export declare const InvalidExpirationError: {
|
|
|
306
202
|
stackTraceLimit: number;
|
|
307
203
|
};
|
|
308
204
|
export declare const InsufficientBalanceError: {
|
|
309
|
-
new (
|
|
310
|
-
[key: string]:
|
|
311
|
-
name: string;
|
|
312
|
-
message: string;
|
|
313
|
-
stack?: string;
|
|
314
|
-
};
|
|
315
|
-
new (props: any): {
|
|
316
|
-
[key: string]: any;
|
|
205
|
+
new (msg?: string | Record<string, unknown>, props?: Record<string, unknown>): {
|
|
206
|
+
[key: string]: unknown;
|
|
317
207
|
name: string;
|
|
318
208
|
message: string;
|
|
319
209
|
stack?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InsufficientBalanceError = exports.InvalidExpirationError = exports.InvalidAddressError = exports.InvalidSecretError = exports.NodeError = exports.WalletError = exports.InvalidDestinationAddressError = exports.BlockNotFoundError = exports.TxFailedError = exports.TxNotFoundError = exports.PendingTxError = exports.InvalidProviderResponseError = exports.UnimplementedMethodError = exports.UnsupportedMethodError = exports.NoProviderError = exports.DuplicateProviderError = exports.InvalidProviderError = exports.ProviderNotFoundError = exports.StandardError = void 0;
|
|
7
|
-
|
|
3
|
+
exports.InsufficientBalanceError = exports.InvalidExpirationError = exports.InvalidAddressError = exports.InvalidSecretError = exports.NodeError = exports.WalletError = exports.InvalidDestinationAddressError = exports.BlockNotFoundError = exports.TxFailedError = exports.TxNotFoundError = exports.PendingTxError = exports.InvalidProviderResponseError = exports.UnimplementedMethodError = exports.UnsupportedMethodError = exports.NoProviderError = exports.DuplicateProviderError = exports.InvalidProviderError = exports.ProviderNotFoundError = exports.StandardError = exports.BaseError = void 0;
|
|
4
|
+
class BaseError extends Error {
|
|
5
|
+
constructor(msg, props) {
|
|
6
|
+
super();
|
|
7
|
+
// Let all properties be enumerable for easier serialization.
|
|
8
|
+
if (msg && typeof msg === 'object') {
|
|
9
|
+
props = msg;
|
|
10
|
+
msg = undefined;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.message = typeof msg === 'string' ? msg : '';
|
|
14
|
+
}
|
|
15
|
+
// Name has to be an own property (or on the prototype a single step up) for
|
|
16
|
+
// the stack to be printed with the correct name.
|
|
17
|
+
if (props) {
|
|
18
|
+
Object.assign(this, props);
|
|
19
|
+
}
|
|
20
|
+
if (!Object.prototype.hasOwnProperty.call(this, 'name')) {
|
|
21
|
+
this.name = Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(this), 'name')
|
|
22
|
+
? this.name
|
|
23
|
+
: this.constructor.name;
|
|
24
|
+
}
|
|
25
|
+
// Capture stack trace
|
|
26
|
+
if (Error.captureStackTrace) {
|
|
27
|
+
Error.captureStackTrace(this, this.constructor);
|
|
28
|
+
}
|
|
29
|
+
// Ensure 'name' property is not enumerable
|
|
30
|
+
Object.defineProperty(this, 'name', {
|
|
31
|
+
value: 'StandardError',
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.BaseError = BaseError;
|
|
8
39
|
function createError(name) {
|
|
9
|
-
const Error = class extends
|
|
40
|
+
const Error = class extends BaseError {
|
|
10
41
|
};
|
|
11
42
|
Error.prototype.name = name;
|
|
12
43
|
return Error;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"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"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsufficientBalanceError = exports.InvalidExpirationError = exports.InvalidAddressError = exports.InvalidSecretError = exports.NodeError = exports.WalletError = exports.InvalidDestinationAddressError = exports.BlockNotFoundError = exports.TxFailedError = exports.TxNotFoundError = exports.PendingTxError = exports.InvalidProviderResponseError = exports.UnimplementedMethodError = exports.UnsupportedMethodError = exports.NoProviderError = exports.DuplicateProviderError = exports.InvalidProviderError = exports.ProviderNotFoundError = exports.StandardError = exports.BaseError = void 0;
|
|
4
|
+
class BaseError extends Error {
|
|
5
|
+
constructor(msg, props) {
|
|
6
|
+
super();
|
|
7
|
+
// Let all properties be enumerable for easier serialization.
|
|
8
|
+
if (msg && typeof msg === 'object') {
|
|
9
|
+
props = msg;
|
|
10
|
+
msg = undefined;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.message = typeof msg === 'string' ? msg : '';
|
|
14
|
+
}
|
|
15
|
+
// Name has to be an own property (or on the prototype a single step up) for
|
|
16
|
+
// the stack to be printed with the correct name.
|
|
17
|
+
if (props) {
|
|
18
|
+
Object.assign(this, props);
|
|
19
|
+
}
|
|
20
|
+
if (!Object.prototype.hasOwnProperty.call(this, 'name')) {
|
|
21
|
+
this.name = Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(this), 'name')
|
|
22
|
+
? this.name
|
|
23
|
+
: this.constructor.name;
|
|
24
|
+
}
|
|
25
|
+
// Capture stack trace
|
|
26
|
+
if (Error.captureStackTrace) {
|
|
27
|
+
Error.captureStackTrace(this, this.constructor);
|
|
28
|
+
}
|
|
29
|
+
// Ensure 'name' property is not enumerable
|
|
30
|
+
Object.defineProperty(this, 'name', {
|
|
31
|
+
value: 'StandardError',
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.BaseError = BaseError;
|
|
39
|
+
function createError(name) {
|
|
40
|
+
const Error = class extends BaseError {
|
|
41
|
+
};
|
|
42
|
+
Error.prototype.name = name;
|
|
43
|
+
return Error;
|
|
44
|
+
}
|
|
45
|
+
exports.StandardError = createError('StandardError');
|
|
46
|
+
exports.ProviderNotFoundError = createError('ProviderNotFoundError');
|
|
47
|
+
exports.InvalidProviderError = createError('InvalidProviderError');
|
|
48
|
+
exports.DuplicateProviderError = createError('DuplicateProviderError');
|
|
49
|
+
exports.NoProviderError = createError('NoProviderError');
|
|
50
|
+
exports.UnsupportedMethodError = createError('UnsupportedMethodError');
|
|
51
|
+
exports.UnimplementedMethodError = createError('UnimplementedMethodError');
|
|
52
|
+
exports.InvalidProviderResponseError = createError('InvalidProviderResponseError');
|
|
53
|
+
exports.PendingTxError = createError('PendingTxError');
|
|
54
|
+
exports.TxNotFoundError = createError('TxNotFoundError');
|
|
55
|
+
exports.TxFailedError = createError('TxFailedError');
|
|
56
|
+
exports.BlockNotFoundError = createError('BlockNotFoundError');
|
|
57
|
+
exports.InvalidDestinationAddressError = createError('InvalidDestinationAddressError');
|
|
58
|
+
exports.WalletError = createError('WalletError');
|
|
59
|
+
exports.NodeError = createError('NodeError');
|
|
60
|
+
exports.InvalidSecretError = createError('InvalidSecretError');
|
|
61
|
+
exports.InvalidAddressError = createError('InvalidAddressError');
|
|
62
|
+
exports.InvalidExpirationError = createError('InvalidExpirationError');
|
|
63
|
+
exports.InsufficientBalanceError = createError('InsufficientBalanceError');
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.ts
CHANGED
|
@@ -1,4 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
export class BaseError extends Error {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
|
|
4
|
+
constructor(
|
|
5
|
+
msg?: string | Record<string, unknown>,
|
|
6
|
+
props?: Record<string, unknown>,
|
|
7
|
+
) {
|
|
8
|
+
super();
|
|
9
|
+
|
|
10
|
+
// Let all properties be enumerable for easier serialization.
|
|
11
|
+
if (msg && typeof msg === 'object') {
|
|
12
|
+
props = msg;
|
|
13
|
+
msg = undefined;
|
|
14
|
+
} else {
|
|
15
|
+
this.message = typeof msg === 'string' ? msg : '';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Name has to be an own property (or on the prototype a single step up) for
|
|
19
|
+
// the stack to be printed with the correct name.
|
|
20
|
+
if (props) {
|
|
21
|
+
Object.assign(this, props);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!Object.prototype.hasOwnProperty.call(this, 'name')) {
|
|
25
|
+
this.name = Object.prototype.hasOwnProperty.call(
|
|
26
|
+
Object.getPrototypeOf(this),
|
|
27
|
+
'name',
|
|
28
|
+
)
|
|
29
|
+
? this.name
|
|
30
|
+
: this.constructor.name;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Capture stack trace
|
|
34
|
+
if (Error.captureStackTrace) {
|
|
35
|
+
Error.captureStackTrace(this, this.constructor);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Ensure 'name' property is not enumerable
|
|
39
|
+
Object.defineProperty(this, 'name', {
|
|
40
|
+
value: 'StandardError',
|
|
41
|
+
enumerable: false,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
2
47
|
|
|
3
48
|
function createError(name: string) {
|
|
4
49
|
const Error = class extends BaseError {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomicfinance/errors",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"lint": "../../node_modules/.bin/eslint --ignore-path ../../.eslintignore -c ../../.eslintrc.js .",
|
|
23
23
|
"lint:fix": "../../node_modules/.bin/eslint --fix --ignore-path ../../.eslintignore -c ../../.eslintrc.js ."
|
|
24
24
|
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@types/standard-error": "^1.1.0",
|
|
27
|
-
"standard-error": "^1.1.0"
|
|
28
|
-
},
|
|
29
25
|
"publishConfig": {
|
|
30
26
|
"access": "public"
|
|
31
27
|
},
|
package/CHANGELOG.md
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# @atomicfinance/errors
|
|
2
|
-
|
|
3
|
-
## 3.4.7
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 0ba01ef: Bump @node-dlc to 0.23.6
|
|
8
|
-
|
|
9
|
-
## 3.4.6
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- b765b9c: Bump nodep-dlc to 0.23.5
|
|
14
|
-
|
|
15
|
-
## 3.4.5
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- 74b7a4f: Bump node-dlc to 0.23.4
|
|
20
|
-
|
|
21
|
-
## 3.4.4
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- cc8f06a: Bump node-dlc to 0.23.3
|
|
26
|
-
|
|
27
|
-
## 3.4.3
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- db49017: Bump node-dlc to 0.23.2 for all packages
|
|
32
|
-
|
|
33
|
-
## 3.4.2
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
- e701ba6: Bump node-dlc- to 0.23.1 and add node-dlc batch tx builder validation tests
|
|
38
|
-
|
|
39
|
-
## 3.4.1
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- 9781efe: Add getInputsForDualFunding functionality and bump @node-dlc
|
|
44
|
-
|
|
45
|
-
## 3.4.0
|
|
46
|
-
|
|
47
|
-
### Minor Changes
|
|
48
|
-
|
|
49
|
-
- 314d7d7: Add batch dlc funding transactions
|
|
50
|
-
|
|
51
|
-
## 3.3.1
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- 7f6f4a8: Fix rounding error with find payout
|
|
56
|
-
|
|
57
|
-
## 3.3.0
|
|
58
|
-
|
|
59
|
-
### Minor Changes
|
|
60
|
-
|
|
61
|
-
- 4a512ee: Fix find outcome index for hyperbola payout curve edge case
|
|
62
|
-
|
|
63
|
-
## 3.2.5
|
|
64
|
-
|
|
65
|
-
## 3.2.4
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- 177b76a: Upgrade node-dlc to 0.22.4
|
|
70
|
-
|
|
71
|
-
## 3.2.3
|
|
72
|
-
|
|
73
|
-
## 3.2.2
|
|
74
|
-
|
|
75
|
-
## 3.2.1
|
|
76
|
-
|
|
77
|
-
## 3.2.0
|
|
78
|
-
|
|
79
|
-
## 3.1.1
|
|
80
|
-
|
|
81
|
-
## 3.1.0
|
|
82
|
-
|
|
83
|
-
## 3.0.1
|
|
84
|
-
|
|
85
|
-
## 3.0.0
|
|
86
|
-
|
|
87
|
-
### Major Changes
|
|
88
|
-
|
|
89
|
-
- a06082e: Create unified standalone `bitcoin-abstraction-layer` package
|