@factorearth/recordmiddleware-errorhandler 1.0.0 → 1.0.2-alpha.0
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.
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* @param taskArguments The arguments we need to pass into the task
|
|
8
8
|
* @returns The result of the task, or the error that prevented it from executing
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function errorHandler<TaskResult, TaskArguments extends any[]>(err: unknown, task: (...args: TaskArguments) => Promise<TaskResult>, evaluator: (result: TaskResult) => boolean, ...taskArguments: TaskArguments): Promise<unknown>;
|
|
@@ -9,7 +9,7 @@ import { backoff } from "./backOff";
|
|
|
9
9
|
* @param taskArguments The arguments we need to pass into the task
|
|
10
10
|
* @returns The result of the task, or the error that prevented it from executing
|
|
11
11
|
*/
|
|
12
|
-
export async function
|
|
12
|
+
export async function errorHandler(err, task, evaluator, ...taskArguments) {
|
|
13
13
|
const canBeRetried = determineRetryableDynamo(err);
|
|
14
14
|
if (canBeRetried) {
|
|
15
15
|
const result = await backoff(task, evaluator, undefined, ...taskArguments);
|
|
@@ -17,4 +17,4 @@ export async function handler(err, task, evaluator, ...taskArguments) {
|
|
|
17
17
|
}
|
|
18
18
|
return err;
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=errorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../lib/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAA0C,GAAY,EAAE,IAAqD,EAAE,SAA0C,EAAE,GAAG,aAA4B;IAC3N,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAC;AACpE,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAC;AACpE,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorearth/recordmiddleware-errorhandler",
|
|
3
|
-
"version": "1.0.0",
|
|
3
|
+
"version": "1.0.2-alpha.0",
|
|
4
4
|
"description": "A module for handling CRUD errors in lambda",
|
|
5
5
|
"author": "madtrx <marlin.makori@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/FactorEarth/RecordMiddleware#readme",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"access": "public",
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "19b20214754cd8c2ec695dd442d16856e6d52df5"
|
|
29
29
|
}
|
package/dist/handler.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../lib/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAA0C,GAAY,EAAE,IAAuD,EAAE,SAA0C,EAAE,GAAG,aAA4B;IACxN,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|