@lido-nestjs/execution 1.9.3 → 1.10.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/common/errors.d.ts
CHANGED
|
@@ -2,4 +2,8 @@ export declare const nonRetryableErrors: (string | number)[];
|
|
|
2
2
|
export declare type ErrorWithCode = Error & {
|
|
3
3
|
code: number | string;
|
|
4
4
|
};
|
|
5
|
+
export declare type ServerError = ErrorWithCode & {
|
|
6
|
+
serverError: object;
|
|
7
|
+
};
|
|
5
8
|
export declare const isErrorHasCode: (error: unknown) => error is ErrorWithCode;
|
|
9
|
+
export declare const isCallExceptionServerError: (error: ErrorWithCode) => error is ServerError;
|
package/dist/common/errors.js
CHANGED
|
@@ -68,7 +68,12 @@ const nonRetryableErrors = [
|
|
|
68
68
|
const isErrorHasCode = (error) => {
|
|
69
69
|
return (error instanceof Error &&
|
|
70
70
|
Object.prototype.hasOwnProperty.call(error, 'code'));
|
|
71
|
+
};
|
|
72
|
+
const isCallExceptionServerError = (error) => {
|
|
73
|
+
return (error.code === logger.ErrorCode.CALL_EXCEPTION &&
|
|
74
|
+
Object.prototype.hasOwnProperty.call(error, 'serverError'));
|
|
71
75
|
};
|
|
72
76
|
|
|
77
|
+
exports.isCallExceptionServerError = isCallExceptionServerError;
|
|
73
78
|
exports.isErrorHasCode = isErrorHasCode;
|
|
74
79
|
exports.nonRetryableErrors = nonRetryableErrors;
|
|
@@ -104,7 +104,9 @@ exports.SimpleFallbackJsonRpcBatchProvider = class SimpleFallbackJsonRpcBatchPro
|
|
|
104
104
|
this.logger.log(`Switched to next provider for execution layer`);
|
|
105
105
|
}
|
|
106
106
|
errorShouldBeReThrown(error) {
|
|
107
|
-
return errors.isErrorHasCode(error) &&
|
|
107
|
+
return (errors.isErrorHasCode(error) &&
|
|
108
|
+
errors.nonRetryableErrors.includes(error.code) &&
|
|
109
|
+
!errors.isCallExceptionServerError(error));
|
|
108
110
|
}
|
|
109
111
|
async perform(method, params) {
|
|
110
112
|
const retry = retrier.retrier(this.logger, this.config.maxRetries, this.config.minBackoffMs, this.config.maxBackoffMs, this.config.logRetries, (e) => this.errorShouldBeReThrown(e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lido-nestjs/execution",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@ethersproject/properties": "^5.5.0",
|
|
42
42
|
"@ethersproject/providers": "^5.5.3",
|
|
43
43
|
"@ethersproject/web": "^5.5.1",
|
|
44
|
-
"@lido-nestjs/logger": "1.3.
|
|
44
|
+
"@lido-nestjs/logger": "1.3.2",
|
|
45
45
|
"@lido-nestjs/middleware": "1.2.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|