1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export class BitGoJsError extends Error {
|
8 | public constructor(message?: string) {
|
9 | super(message);
|
10 | if (typeof Error.captureStackTrace === 'function') {
|
11 | Error.captureStackTrace(this);
|
12 | }
|
13 | Object.setPrototypeOf(this, BitGoJsError.prototype);
|
14 | }
|
15 | }
|
16 |
|
17 | export class TlsConfigurationError extends BitGoJsError {
|
18 | public constructor(message?: string) {
|
19 | super(message || 'TLS is configuration is invalid');
|
20 | Object.setPrototypeOf(this, TlsConfigurationError.prototype);
|
21 | }
|
22 | }
|
23 |
|
24 | export class NodeEnvironmentError extends BitGoJsError {
|
25 | public constructor(message?: string) {
|
26 | super(message || 'NODE_ENV is invalid for the current bitgo environment');
|
27 | Object.setPrototypeOf(this, NodeEnvironmentError.prototype);
|
28 | }
|
29 | }
|
30 |
|
31 | export class UnsupportedCoinError extends BitGoJsError {
|
32 | public constructor(coin: string) {
|
33 | super(`Coin or token type ${coin} not supported or not compiled. Please be sure that you are using the latest version of BitGoJS.`);
|
34 | Object.setPrototypeOf(this, UnsupportedCoinError.prototype);
|
35 | }
|
36 | }
|
37 |
|
38 | export class AddressTypeChainMismatchError extends BitGoJsError {
|
39 | constructor(addressType: string, chain: number | string) {
|
40 | super(`address type ${addressType} does not correspond to chain ${chain}`);
|
41 | Object.setPrototypeOf(this, AddressTypeChainMismatchError.prototype);
|
42 | }
|
43 | }
|
44 |
|
45 | export class P2shP2wshUnsupportedError extends BitGoJsError {
|
46 | constructor(message?: string) {
|
47 | super(message || 'p2shP2wsh not supported by this coin');
|
48 | Object.setPrototypeOf(this, P2shP2wshUnsupportedError.prototype);
|
49 | }
|
50 | }
|
51 |
|
52 | export class P2wshUnsupportedError extends BitGoJsError {
|
53 | public constructor(message?: string) {
|
54 | super(message || 'p2wsh not supported by this coin');
|
55 | Object.setPrototypeOf(this, P2wshUnsupportedError.prototype);
|
56 | }
|
57 | }
|
58 |
|
59 | export class UnsupportedAddressTypeError extends BitGoJsError {
|
60 | public constructor(message?: string) {
|
61 | super(message || 'invalid address type');
|
62 | Object.setPrototypeOf(this, UnsupportedAddressTypeError.prototype);
|
63 | }
|
64 | }
|
65 |
|
66 | export class InvalidAddressError extends BitGoJsError {
|
67 | public constructor(message?: string) {
|
68 | super(message || 'invalid address');
|
69 | Object.setPrototypeOf(this, InvalidAddressError.prototype);
|
70 | }
|
71 | }
|
72 |
|
73 | export class InvalidAddressVerificationObjectPropertyError extends BitGoJsError {
|
74 | public constructor(message?: string) {
|
75 | super(message || 'address validation failure');
|
76 | Object.setPrototypeOf(this, InvalidAddressVerificationObjectPropertyError.prototype);
|
77 | }
|
78 | }
|
79 |
|
80 | export class UnexpectedAddressError extends BitGoJsError {
|
81 | public constructor(message?: string) {
|
82 | super(message || 'address validation failure');
|
83 | Object.setPrototypeOf(this, UnexpectedAddressError.prototype);
|
84 | }
|
85 | }
|
86 |
|
87 | export class InvalidAddressDerivationPropertyError extends BitGoJsError {
|
88 | public constructor(message?: string) {
|
89 | super(message || 'address chain and/or index are invalid');
|
90 | Object.setPrototypeOf(this, InvalidAddressDerivationPropertyError.prototype);
|
91 | }
|
92 | }
|
93 |
|
94 | export class WalletRecoveryUnsupported extends BitGoJsError {
|
95 | public constructor(message?: string) {
|
96 | super(message || 'wallet recovery is not supported by this coin');
|
97 | Object.setPrototypeOf(this, WalletRecoveryUnsupported.prototype);
|
98 | }
|
99 | }
|
100 |
|
101 | export class MethodNotImplementedError extends BitGoJsError {
|
102 | public constructor(message?: string) {
|
103 | super(message || 'method not implemented');
|
104 | Object.setPrototypeOf(this, MethodNotImplementedError.prototype);
|
105 | }
|
106 | }
|
107 |
|
108 | export class BlockExplorerUnavailable extends BitGoJsError {
|
109 | public constructor(message?: string) {
|
110 | super(message || 'third-party blockexplorer not responding');
|
111 | Object.setPrototypeOf(this, BlockExplorerUnavailable.prototype);
|
112 | }
|
113 | }
|
114 |
|
115 | export class InvalidMemoIdError extends InvalidAddressError {
|
116 | public constructor(message?: string) {
|
117 | super(message || 'invalid memo id');
|
118 | Object.setPrototypeOf(this, InvalidMemoIdError.prototype);
|
119 | }
|
120 | }
|
121 |
|
122 | export class InvalidPaymentIdError extends InvalidAddressError {
|
123 | public constructor(message?: string) {
|
124 | super(message || 'invalid payment id');
|
125 | Object.setPrototypeOf(this, InvalidPaymentIdError.prototype);
|
126 | }
|
127 | }
|
128 |
|
129 | export class KeyRecoveryServiceError extends BitGoJsError {
|
130 | public constructor(message?: string) {
|
131 | super(message || 'key recovery service encountered an error');
|
132 | Object.setPrototypeOf(this, KeyRecoveryServiceError.prototype);
|
133 | }
|
134 | }
|
135 |
|
136 | export class AddressGenerationError extends BitGoJsError {
|
137 | public constructor(message?: string) {
|
138 | super(message || 'address generation failed');
|
139 | Object.setPrototypeOf(this, AddressGenerationError.prototype);
|
140 | }
|
141 | }
|
142 |
|
143 | export class EthereumLibraryUnavailableError extends BitGoJsError {
|
144 | public constructor(packageName: string) {
|
145 | super(`Ethereum library required for operation is not available. Please install "${(packageName)}".`);
|
146 | Object.setPrototypeOf(this, EthereumLibraryUnavailableError.prototype);
|
147 | }
|
148 | }
|
149 |
|
150 | export class StellarFederationUserNotFoundError extends BitGoJsError {
|
151 | public constructor(message?: string) {
|
152 | super(message || 'account not found');
|
153 | Object.setPrototypeOf(this, StellarFederationUserNotFoundError.prototype);
|
154 | }
|
155 | }
|
156 |
|
157 | export class ErrorNoInputToRecover extends BitGoJsError {
|
158 | public constructor(message?: string) {
|
159 | super(message || 'No input to recover - aborting!');
|
160 | Object.setPrototypeOf(this, ErrorNoInputToRecover.prototype);
|
161 | }
|
162 | }
|
163 |
|
164 | export class InvalidKeyPathError extends BitGoJsError {
|
165 | public constructor(keyPath: string) {
|
166 | super(`invalid keypath: ${keyPath}`);
|
167 | Object.setPrototypeOf(this, InvalidKeyPathError.prototype);
|
168 | }
|
169 | }
|
170 |
|
171 | export class InvalidTransactionError extends BitGoJsError {
|
172 | public constructor(message?: string) {
|
173 | super(message || 'Invalid transaction');
|
174 | Object.setPrototypeOf(this, InvalidTransactionError.prototype);
|
175 | }
|
176 | }
|