@tetherto/wdk-wallet 1.0.0-beta.15 → 1.0.0-beta.17
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/index.js +11 -12
- package/package.json +5 -1
- package/src/errors.js +280 -19
- package/src/multisig/errors.js +54 -0
- package/src/multisig/index.js +42 -0
- package/src/multisig/multisig-message-signing-read-only.js +63 -0
- package/src/multisig/multisig-message-signing.js +64 -0
- package/src/multisig/multisig-owner-management.js +94 -0
- package/src/multisig/wallet-account-multisig.js +144 -0
- package/src/multisig/wallet-account-read-only-multisig.js +98 -0
- package/src/protocols/bridge-protocol.js +35 -1
- package/src/protocols/errors.js +510 -0
- package/src/protocols/fiat-protocol.js +104 -4
- package/src/protocols/index.js +13 -0
- package/src/protocols/lending-protocol.js +114 -2
- package/src/protocols/sda-protocol.js +103 -16
- package/src/protocols/swap-protocol.js +35 -1
- package/src/protocols/swidge-protocol.js +166 -55
- package/src/signer.js +8 -4
- package/src/wallet-account-read-only-simple.js +162 -0
- package/src/wallet-account-read-only.js +176 -55
- package/src/wallet-account.js +25 -1
- package/src/wallet-manager.js +38 -22
- package/types/index.d.ts +9 -2
- package/types/src/errors.d.ts +198 -14
- package/types/src/multisig/errors.d.ts +33 -0
- package/types/src/multisig/index.d.ts +15 -0
- package/types/src/multisig/multisig-message-signing-read-only.d.ts +53 -0
- package/types/src/multisig/multisig-message-signing.d.ts +40 -0
- package/types/src/multisig/multisig-owner-management.d.ts +65 -0
- package/types/src/multisig/wallet-account-multisig.d.ts +101 -0
- package/types/src/multisig/wallet-account-read-only-multisig.d.ts +83 -0
- package/types/src/protocols/bridge-protocol.d.ts +39 -3
- package/types/src/protocols/errors.d.ts +366 -0
- package/types/src/protocols/fiat-protocol.d.ts +103 -9
- package/types/src/protocols/index.d.ts +11 -0
- package/types/src/protocols/lending-protocol.d.ts +118 -4
- package/types/src/protocols/sda-protocol.d.ts +120 -23
- package/types/src/protocols/swap-protocol.d.ts +40 -4
- package/types/src/protocols/swidge-protocol.d.ts +106 -38
- package/types/src/signer.d.ts +6 -4
- package/types/src/wallet-account-read-only-simple.d.ts +144 -0
- package/types/src/wallet-account-read-only.d.ts +97 -39
- package/types/src/wallet-account.d.ts +27 -3
- package/types/src/wallet-manager.d.ts +37 -35
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
// Copyright 2024 Tether Operations Limited
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
'use strict'
|
|
15
|
+
|
|
16
|
+
import { InvalidTokenError, MaximumFeeExceededError, NoSuchElementError, NotImplementedError, ProviderError, ProviderRequiredError, UnsupportedOperationError, ValueError, WdkError } from '../errors.js'
|
|
17
|
+
|
|
18
|
+
export { InvalidTokenError, MaximumFeeExceededError, NoSuchElementError, NotImplementedError, ProviderError, ProviderRequiredError, UnsupportedOperationError, ValueError, WdkError }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} SwapErrorOptions
|
|
22
|
+
* @property {SwapErrorReason} reason - The error's reason.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {Object} BridgeErrorOptions
|
|
27
|
+
* @property {BridgeErrorReason} reason - The error's reason.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {Object} SupplyErrorOptions
|
|
32
|
+
* @property {SupplyErrorReason} reason - The error's reason.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} WithdrawErrorOptions
|
|
37
|
+
* @property {WithdrawErrorReason} reason - The error's reason.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} BorrowErrorOptions
|
|
42
|
+
* @property {BorrowErrorReason} reason - The error's reason.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {Object} RepayErrorOptions
|
|
47
|
+
* @property {RepayErrorReason} reason - The error's reason.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} BuyErrorOptions
|
|
52
|
+
* @property {BuyErrorReason} reason - The error's reason.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @typedef {Object} SellErrorOptions
|
|
57
|
+
* @property {SellErrorReason} reason - The error's reason.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} SwidgeErrorOptions
|
|
62
|
+
* @property {SwidgeErrorReason} reason - The error's reason.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @typedef {Object} SdaErrorOptions
|
|
67
|
+
* @property {SdaErrorReason} reason - The error's reason.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Enum for swap error reasons.
|
|
72
|
+
*
|
|
73
|
+
* @readonly
|
|
74
|
+
* @enum {string}
|
|
75
|
+
*/
|
|
76
|
+
export const SwapErrorReason = {
|
|
77
|
+
/**
|
|
78
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the swap.
|
|
79
|
+
*/
|
|
80
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
81
|
+
/**
|
|
82
|
+
* Thrown when the account doesn't have enough funds to perform the swap.
|
|
83
|
+
*/
|
|
84
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE',
|
|
85
|
+
/**
|
|
86
|
+
* Thrown when the output amount is lower than the min. amount out option.
|
|
87
|
+
*/
|
|
88
|
+
COULD_NOT_MET_THRESHOLD: 'COULD_NOT_MET_THRESHOLD'
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Enum for bridge error reasons.
|
|
93
|
+
*
|
|
94
|
+
* @readonly
|
|
95
|
+
* @enum {string}
|
|
96
|
+
*/
|
|
97
|
+
export const BridgeErrorReason = {
|
|
98
|
+
/**
|
|
99
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the bridge.
|
|
100
|
+
*/
|
|
101
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
102
|
+
/**
|
|
103
|
+
* Thrown when the account doesn't have enough funds to perform the bridge.
|
|
104
|
+
*/
|
|
105
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE'
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Enum for supply error reasons.
|
|
110
|
+
*
|
|
111
|
+
* @readonly
|
|
112
|
+
* @enum {string}
|
|
113
|
+
*/
|
|
114
|
+
export const SupplyErrorReason = {
|
|
115
|
+
/**
|
|
116
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the supply.
|
|
117
|
+
*/
|
|
118
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
119
|
+
/**
|
|
120
|
+
* Thrown when the account doesn't have enough funds to perform the supply.
|
|
121
|
+
*/
|
|
122
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE'
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Enum for withdraw error reasons.
|
|
127
|
+
*
|
|
128
|
+
* @readonly
|
|
129
|
+
* @enum {string}
|
|
130
|
+
*/
|
|
131
|
+
export const WithdrawErrorReason = {
|
|
132
|
+
/**
|
|
133
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the withdraw.
|
|
134
|
+
*/
|
|
135
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
136
|
+
/**
|
|
137
|
+
* Thrown when the account doesn't have enough funds to perform the withdraw.
|
|
138
|
+
*/
|
|
139
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE'
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Enum for borrow error reasons.
|
|
144
|
+
*
|
|
145
|
+
* @readonly
|
|
146
|
+
* @enum {string}
|
|
147
|
+
*/
|
|
148
|
+
export const BorrowErrorReason = {
|
|
149
|
+
/**
|
|
150
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the borrow.
|
|
151
|
+
*/
|
|
152
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
153
|
+
/**
|
|
154
|
+
* Thrown when the account doesn't have enough funds to perform the borrow.
|
|
155
|
+
*/
|
|
156
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE'
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Enum for repay error reasons.
|
|
161
|
+
*
|
|
162
|
+
* @readonly
|
|
163
|
+
* @enum {string}
|
|
164
|
+
*/
|
|
165
|
+
export const RepayErrorReason = {
|
|
166
|
+
/**
|
|
167
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the repay.
|
|
168
|
+
*/
|
|
169
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
170
|
+
/**
|
|
171
|
+
* Thrown when the account doesn't have enough funds to perform the repay.
|
|
172
|
+
*/
|
|
173
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE'
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Enum for buy error reasons.
|
|
178
|
+
*
|
|
179
|
+
* @readonly
|
|
180
|
+
* @enum {string}
|
|
181
|
+
*/
|
|
182
|
+
export const BuyErrorReason = {
|
|
183
|
+
/**
|
|
184
|
+
* Thrown when the user doesn't have enough funds to perform the purchase.
|
|
185
|
+
*/
|
|
186
|
+
INSUFFICIENT_FUNDS: 'INSUFFICIENT_FUNDS'
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Enum for sell error reasons.
|
|
191
|
+
*
|
|
192
|
+
* @readonly
|
|
193
|
+
* @enum {string}
|
|
194
|
+
*/
|
|
195
|
+
export const SellErrorReason = {
|
|
196
|
+
/**
|
|
197
|
+
* Thrown when the user doesn't have enough funds to perform the sale.
|
|
198
|
+
*/
|
|
199
|
+
INSUFFICIENT_FUNDS: 'INSUFFICIENT_FUNDS'
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Enum for swidge error reasons.
|
|
204
|
+
*
|
|
205
|
+
* @readonly
|
|
206
|
+
* @enum {string}
|
|
207
|
+
*/
|
|
208
|
+
export const SwidgeErrorReason = {
|
|
209
|
+
/**
|
|
210
|
+
* Thrown when the account doesn't have enough funds to cover the costs of the swidge.
|
|
211
|
+
*/
|
|
212
|
+
INSUFFICIENT_BALANCE: 'INSUFFICIENT_BALANCE',
|
|
213
|
+
/**
|
|
214
|
+
* Thrown when the account doesn't have enough funds to perform the swidge.
|
|
215
|
+
*/
|
|
216
|
+
INSUFFICIENT_TOKEN_BALANCE: 'INSUFFICIENT_TOKEN_BALANCE',
|
|
217
|
+
/**
|
|
218
|
+
* Thrown when the output amount is lower than the min. amount out option.
|
|
219
|
+
*/
|
|
220
|
+
COULD_NOT_MET_THRESHOLD: 'COULD_NOT_MET_THRESHOLD',
|
|
221
|
+
/**
|
|
222
|
+
* Thrown when the actual slippage is higher than the slippage option.
|
|
223
|
+
*/
|
|
224
|
+
SLIPPAGE_TOO_HIGH: 'SLIPPAGE_TOO_HIGH'
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Enum for SDA error reasons.
|
|
229
|
+
*
|
|
230
|
+
* @readonly
|
|
231
|
+
* @enum {string}
|
|
232
|
+
*/
|
|
233
|
+
export const SdaErrorReason = {
|
|
234
|
+
/**
|
|
235
|
+
* Thrown when the protocol doesn't support the given route.
|
|
236
|
+
*/
|
|
237
|
+
ROUTE_NOT_SUPPORTED: 'ROUTE_NOT_SUPPORTED'
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Thrown when an operation requires an account to be set.
|
|
242
|
+
*/
|
|
243
|
+
export class AccountRequiredError extends WdkError {
|
|
244
|
+
/**
|
|
245
|
+
* Creates a new account required error.
|
|
246
|
+
*
|
|
247
|
+
* @param {string} message - The error's message.
|
|
248
|
+
*/
|
|
249
|
+
constructor (message) {
|
|
250
|
+
super(message)
|
|
251
|
+
|
|
252
|
+
this.name = 'AccountRequiredError'
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Thrown when an operation requires a read-only account to be set.
|
|
258
|
+
*/
|
|
259
|
+
export class ReadOnlyAccountRequiredError extends AccountRequiredError {
|
|
260
|
+
/**
|
|
261
|
+
* Creates a new read-only account required error.
|
|
262
|
+
*
|
|
263
|
+
* @param {string} message - The error's message.
|
|
264
|
+
*/
|
|
265
|
+
constructor (message) {
|
|
266
|
+
super(message)
|
|
267
|
+
|
|
268
|
+
this.name = 'ReadOnlyAccountRequiredError'
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Thrown when a swap fails with an error.
|
|
274
|
+
*/
|
|
275
|
+
export class SwapError extends WdkError {
|
|
276
|
+
/**
|
|
277
|
+
* Creates a new swap error.
|
|
278
|
+
*
|
|
279
|
+
* @param {string} message - The error's message.
|
|
280
|
+
* @param {SwapErrorOptions & ErrorOptions} options - The error's options.
|
|
281
|
+
*/
|
|
282
|
+
constructor (message, options) {
|
|
283
|
+
super(message, options)
|
|
284
|
+
|
|
285
|
+
this.name = 'SwapError'
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* The error's reason.
|
|
289
|
+
*
|
|
290
|
+
* @type {string}
|
|
291
|
+
*/
|
|
292
|
+
this.reason = options.reason
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Thrown when a bridge fails with an error.
|
|
298
|
+
*/
|
|
299
|
+
export class BridgeError extends WdkError {
|
|
300
|
+
/**
|
|
301
|
+
* Creates a new bridge error.
|
|
302
|
+
*
|
|
303
|
+
* @param {string} message - The error's message.
|
|
304
|
+
* @param {BridgeErrorOptions & ErrorOptions} options - The error's options.
|
|
305
|
+
*/
|
|
306
|
+
constructor (message, options) {
|
|
307
|
+
super(message, options)
|
|
308
|
+
|
|
309
|
+
this.name = 'BridgeError'
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* The error's reason.
|
|
313
|
+
*
|
|
314
|
+
* @type {string}
|
|
315
|
+
*/
|
|
316
|
+
this.reason = options.reason
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Thrown when a supply fails with an error.
|
|
322
|
+
*/
|
|
323
|
+
export class SupplyError extends WdkError {
|
|
324
|
+
/**
|
|
325
|
+
* Creates a new supply error.
|
|
326
|
+
*
|
|
327
|
+
* @param {string} message - The error's message.
|
|
328
|
+
* @param {SupplyErrorOptions & ErrorOptions} options - The error's options.
|
|
329
|
+
*/
|
|
330
|
+
constructor (message, options) {
|
|
331
|
+
super(message, options)
|
|
332
|
+
|
|
333
|
+
this.name = 'SupplyError'
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* The error's reason.
|
|
337
|
+
*
|
|
338
|
+
* @type {string}
|
|
339
|
+
*/
|
|
340
|
+
this.reason = options.reason
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Thrown when a withdraw fails with an error.
|
|
346
|
+
*/
|
|
347
|
+
export class WithdrawError extends WdkError {
|
|
348
|
+
/**
|
|
349
|
+
* Creates a new withdraw error.
|
|
350
|
+
*
|
|
351
|
+
* @param {string} message - The error's message.
|
|
352
|
+
* @param {WithdrawErrorOptions & ErrorOptions} options - The error's options.
|
|
353
|
+
*/
|
|
354
|
+
constructor (message, options) {
|
|
355
|
+
super(message, options)
|
|
356
|
+
|
|
357
|
+
this.name = 'WithdrawError'
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* The error's reason.
|
|
361
|
+
*
|
|
362
|
+
* @type {string}
|
|
363
|
+
*/
|
|
364
|
+
this.reason = options.reason
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Thrown when a borrow fails with an error.
|
|
370
|
+
*/
|
|
371
|
+
export class BorrowError extends WdkError {
|
|
372
|
+
/**
|
|
373
|
+
* Creates a new borrow error.
|
|
374
|
+
*
|
|
375
|
+
* @param {string} message - The error's message.
|
|
376
|
+
* @param {BorrowErrorOptions & ErrorOptions} options - The error's options.
|
|
377
|
+
*/
|
|
378
|
+
constructor (message, options) {
|
|
379
|
+
super(message, options)
|
|
380
|
+
|
|
381
|
+
this.name = 'BorrowError'
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The error's reason.
|
|
385
|
+
*
|
|
386
|
+
* @type {string}
|
|
387
|
+
*/
|
|
388
|
+
this.reason = options.reason
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Thrown when a repay fails with an error.
|
|
394
|
+
*/
|
|
395
|
+
export class RepayError extends WdkError {
|
|
396
|
+
/**
|
|
397
|
+
* Creates a new repay error.
|
|
398
|
+
*
|
|
399
|
+
* @param {string} message - The error's message.
|
|
400
|
+
* @param {RepayErrorOptions & ErrorOptions} options - The error's options.
|
|
401
|
+
*/
|
|
402
|
+
constructor (message, options) {
|
|
403
|
+
super(message, options)
|
|
404
|
+
|
|
405
|
+
this.name = 'RepayError'
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* The error's reason.
|
|
409
|
+
*
|
|
410
|
+
* @type {string}
|
|
411
|
+
*/
|
|
412
|
+
this.reason = options.reason
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Thrown when a purchase fails with an error.
|
|
418
|
+
*/
|
|
419
|
+
export class BuyError extends WdkError {
|
|
420
|
+
/**
|
|
421
|
+
* Creates a new buy error.
|
|
422
|
+
*
|
|
423
|
+
* @param {string} message - The error's message.
|
|
424
|
+
* @param {BuyErrorOptions & ErrorOptions} options - The error's options.
|
|
425
|
+
*/
|
|
426
|
+
constructor (message, options) {
|
|
427
|
+
super(message, options)
|
|
428
|
+
|
|
429
|
+
this.name = 'BuyError'
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* The error's reason.
|
|
433
|
+
*
|
|
434
|
+
* @type {string}
|
|
435
|
+
*/
|
|
436
|
+
this.reason = options.reason
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Thrown when a sale fails with an error.
|
|
442
|
+
*/
|
|
443
|
+
export class SellError extends WdkError {
|
|
444
|
+
/**
|
|
445
|
+
* Creates a new sell error.
|
|
446
|
+
*
|
|
447
|
+
* @param {string} message - The error's message.
|
|
448
|
+
* @param {SellErrorOptions & ErrorOptions} options - The error's options.
|
|
449
|
+
*/
|
|
450
|
+
constructor (message, options) {
|
|
451
|
+
super(message, options)
|
|
452
|
+
|
|
453
|
+
this.name = 'SellError'
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* The error's reason.
|
|
457
|
+
*
|
|
458
|
+
* @type {string}
|
|
459
|
+
*/
|
|
460
|
+
this.reason = options.reason
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Thrown when a swidge fails with an error.
|
|
466
|
+
*/
|
|
467
|
+
export class SwidgeError extends WdkError {
|
|
468
|
+
/**
|
|
469
|
+
* Creates a new swidge error.
|
|
470
|
+
*
|
|
471
|
+
* @param {string} message - The error's message.
|
|
472
|
+
* @param {SwidgeErrorOptions & ErrorOptions} options - The error's options.
|
|
473
|
+
*/
|
|
474
|
+
constructor (message, options) {
|
|
475
|
+
super(message, options)
|
|
476
|
+
|
|
477
|
+
this.name = 'SwidgeError'
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The error's reason.
|
|
481
|
+
*
|
|
482
|
+
* @type {string}
|
|
483
|
+
*/
|
|
484
|
+
this.reason = options.reason
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Thrown when a SDA fails with an error.
|
|
490
|
+
*/
|
|
491
|
+
export class SdaError extends WdkError {
|
|
492
|
+
/**
|
|
493
|
+
* Creates a new SDA error.
|
|
494
|
+
*
|
|
495
|
+
* @param {string} message - The error's message.
|
|
496
|
+
* @param {SdaErrorOptions & ErrorOptions} options - The error's options.
|
|
497
|
+
*/
|
|
498
|
+
constructor (message, options) {
|
|
499
|
+
super(message, options)
|
|
500
|
+
|
|
501
|
+
this.name = 'SdaError'
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* The error's reason.
|
|
505
|
+
*
|
|
506
|
+
* @type {string}
|
|
507
|
+
*/
|
|
508
|
+
this.reason = options.reason
|
|
509
|
+
}
|
|
510
|
+
}
|