@injectivelabs/exceptions 1.14.17-beta.0 → 1.14.17-beta.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/cjs/utils.d.ts +3 -1
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +25 -17
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/utils.d.ts +3 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +24 -16
- package/dist/esm/utils.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Exception } from './exceptions/types';
|
|
2
|
-
|
|
2
|
+
import { ThrownException } from './types';
|
|
3
|
+
export declare const THROWN_EXCEPTIONS: string[];
|
|
4
|
+
export declare const isThrownException: (exception: Error | Exception | ThrownException) => boolean;
|
|
3
5
|
export declare const formatNotificationDescription: (description: string) => {
|
|
4
6
|
description: string;
|
|
5
7
|
tooltip: string;
|
package/dist/cjs/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,eAAO,MAAM,iBAAiB,UAe7B,CAAA;AAED,eAAO,MAAM,iBAAiB,cACjB,KAAK,GAAG,SAAS,GAAG,eAAe,KAC7C,OAiBF,CAAA;AAED,eAAO,MAAM,6BAA6B,gBAAiB,MAAM;;;CAchE,CAAA"}
|
package/dist/cjs/utils.js
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatNotificationDescription = exports.isThrownException = void 0;
|
|
3
|
+
exports.formatNotificationDescription = exports.isThrownException = exports.THROWN_EXCEPTIONS = void 0;
|
|
4
|
+
exports.THROWN_EXCEPTIONS = [
|
|
5
|
+
'GrpcUnaryRequestException',
|
|
6
|
+
'HttpRequestException',
|
|
7
|
+
'Web3Exception',
|
|
8
|
+
'GeneralException',
|
|
9
|
+
'LedgerException',
|
|
10
|
+
'LedgerCosmosException',
|
|
11
|
+
'MetamaskException',
|
|
12
|
+
'TrezorException',
|
|
13
|
+
'CosmosWalletException',
|
|
14
|
+
'TransactionException',
|
|
15
|
+
'WalletException',
|
|
16
|
+
'TrustWalletException',
|
|
17
|
+
'OkxWalletException',
|
|
18
|
+
'BitGetException',
|
|
19
|
+
];
|
|
4
20
|
const isThrownException = (exception) => {
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'TrezorException',
|
|
14
|
-
'CosmosWalletException',
|
|
15
|
-
'TransactionException',
|
|
16
|
-
'WalletException',
|
|
17
|
-
'TrustWalletException',
|
|
18
|
-
'OkxWalletException',
|
|
19
|
-
'BitGetException',
|
|
20
|
-
].includes(exception.constructor.name)) {
|
|
21
|
+
if (exports.THROWN_EXCEPTIONS.includes(exception.constructor.name)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (exports.THROWN_EXCEPTIONS.includes(exception.name)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if ('errorClass' in exception &&
|
|
28
|
+
exports.THROWN_EXCEPTIONS.includes(exception.errorClass)) {
|
|
21
29
|
return true;
|
|
22
30
|
}
|
|
23
31
|
return false;
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAGa,QAAA,iBAAiB,GAAG;IAC/B,2BAA2B;IAC3B,sBAAsB;IACtB,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,iBAAiB;IACjB,uBAAuB;IACvB,sBAAsB;IACtB,iBAAiB;IACjB,sBAAsB;IACtB,oBAAoB;IACpB,iBAAiB;CAClB,CAAA;AAEM,MAAM,iBAAiB,GAAG,CAC/B,SAA8C,EACrC,EAAE;IACX,IAAI,yBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,yBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IACE,YAAY,IAAI,SAAS;QACzB,yBAAiB,CAAC,QAAQ,CAAE,SAA6B,CAAC,UAAU,CAAC,EACrE,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAnBY,QAAA,iBAAiB,qBAmB7B;AAEM,MAAM,6BAA6B,GAAG,CAAC,WAAmB,EAAE,EAAE;IACnE,MAAM,2BAA2B,GAAG,EAAE,CAAA;IAEtC,IAAI,WAAW,CAAC,MAAM,IAAI,2BAA2B,EAAE,CAAC;QACtD,OAAO;YACL,WAAW;YACX,OAAO,EAAE,EAAE;SACZ,CAAA;IACH,CAAC;IAED,OAAO;QACL,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC,GAAG,MAAM;QACvE,OAAO,EAAE,WAAW;KACrB,CAAA;AACH,CAAC,CAAA;AAdY,QAAA,6BAA6B,iCAczC"}
|
package/dist/esm/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Exception } from './exceptions/types';
|
|
2
|
-
|
|
2
|
+
import { ThrownException } from './types';
|
|
3
|
+
export declare const THROWN_EXCEPTIONS: string[];
|
|
4
|
+
export declare const isThrownException: (exception: Error | Exception | ThrownException) => boolean;
|
|
3
5
|
export declare const formatNotificationDescription: (description: string) => {
|
|
4
6
|
description: string;
|
|
5
7
|
tooltip: string;
|
package/dist/esm/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,eAAO,MAAM,iBAAiB,UAe7B,CAAA;AAED,eAAO,MAAM,iBAAiB,cACjB,KAAK,GAAG,SAAS,GAAG,eAAe,KAC7C,OAiBF,CAAA;AAED,eAAO,MAAM,6BAA6B,gBAAiB,MAAM;;;CAchE,CAAA"}
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
+
export const THROWN_EXCEPTIONS = [
|
|
2
|
+
'GrpcUnaryRequestException',
|
|
3
|
+
'HttpRequestException',
|
|
4
|
+
'Web3Exception',
|
|
5
|
+
'GeneralException',
|
|
6
|
+
'LedgerException',
|
|
7
|
+
'LedgerCosmosException',
|
|
8
|
+
'MetamaskException',
|
|
9
|
+
'TrezorException',
|
|
10
|
+
'CosmosWalletException',
|
|
11
|
+
'TransactionException',
|
|
12
|
+
'WalletException',
|
|
13
|
+
'TrustWalletException',
|
|
14
|
+
'OkxWalletException',
|
|
15
|
+
'BitGetException',
|
|
16
|
+
];
|
|
1
17
|
export const isThrownException = (exception) => {
|
|
2
|
-
if (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'TrezorException',
|
|
11
|
-
'CosmosWalletException',
|
|
12
|
-
'TransactionException',
|
|
13
|
-
'WalletException',
|
|
14
|
-
'TrustWalletException',
|
|
15
|
-
'OkxWalletException',
|
|
16
|
-
'BitGetException',
|
|
17
|
-
].includes(exception.constructor.name)) {
|
|
18
|
+
if (THROWN_EXCEPTIONS.includes(exception.constructor.name)) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (THROWN_EXCEPTIONS.includes(exception.name)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if ('errorClass' in exception &&
|
|
25
|
+
THROWN_EXCEPTIONS.includes(exception.errorClass)) {
|
|
18
26
|
return true;
|
|
19
27
|
}
|
|
20
28
|
return false;
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,2BAA2B;IAC3B,sBAAsB;IACtB,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,iBAAiB;IACjB,uBAAuB;IACvB,sBAAsB;IACtB,iBAAiB;IACjB,sBAAsB;IACtB,oBAAoB;IACpB,iBAAiB;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAA8C,EACrC,EAAE;IACX,IAAI,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IACE,YAAY,IAAI,SAAS;QACzB,iBAAiB,CAAC,QAAQ,CAAE,SAA6B,CAAC,UAAU,CAAC,EACrE,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,WAAmB,EAAE,EAAE;IACnE,MAAM,2BAA2B,GAAG,EAAE,CAAA;IAEtC,IAAI,WAAW,CAAC,MAAM,IAAI,2BAA2B,EAAE,CAAC;QACtD,OAAO;YACL,WAAW;YACX,OAAO,EAAE,EAAE;SACZ,CAAA;IACH,CAAC;IAED,OAAO;QACL,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC,GAAG,MAAM;QACvE,OAAO,EAAE,WAAW;KACrB,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/exceptions",
|
|
3
3
|
"description": "List of exceptions that can be reused throughout Injective's projects.",
|
|
4
|
-
"version": "1.14.17-beta.
|
|
4
|
+
"version": "1.14.17-beta.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"http-status-codes": "^2.2.0",
|
|
37
37
|
"shx": "^0.3.2"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "75682b80f5700f3f1e60ba812637b83931fad540"
|
|
40
40
|
}
|