async-retry.ts
Advanced tools
Comparing version 1.1.1 to 1.2.0
declare type Handlers = { | ||
error: string | RegExp; | ||
error: string | RegExp | Function; | ||
handler: () => void; | ||
@@ -4,0 +4,0 @@ }[]; |
@@ -11,6 +11,17 @@ "use strict"; | ||
logger.debug(`testing "${ex.message}" by /${expectedMessage}/...`); | ||
if (!expectedMessage.test(ex.message)) { | ||
logger.debug(`:( can't handle "${ex.message} by ${expectedMessage}`); | ||
return false; | ||
if (expectedMessage instanceof RegExp) { | ||
if (!expectedMessage.test(ex.message)) { | ||
logger.debug(`:( can't handle "${ex.message} by ${expectedMessage}`); | ||
return false; | ||
} | ||
} | ||
else if (typeof expectedMessage === 'function') { | ||
if (!expectedMessage(ex)) { | ||
logger.debug(`:( can't handle "${ex.message} by ${expectedMessage}`); | ||
return false; | ||
} | ||
} | ||
else { | ||
throw new Error('expectedMessage should be string, RegExp or Function, but got ' + typeof expectedMessage); | ||
} | ||
logger.debug(`handling "${ex.message} by ${expectedMessage} with retry: ${!!retry}...`); | ||
@@ -71,2 +82,2 @@ await handler(); | ||
exports.default = RetryAsyncAction; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV0cnlBc3luYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9yZXRyeUFzeW5jLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsU0FBUyxZQUFZLENBQUMsRUFBRSxFQUFFLE1BQU07SUFDOUIsTUFBTSxDQUFDLEtBQUssQ0FBQyxXQUFXLEVBQUUsRUFBRSxFQUFFLEVBQUUsQ0FBQyxDQUFBO0FBQ25DLENBQUM7QUFFRCxLQUFLLFVBQVUsY0FBYyxDQUFDLGVBQWUsRUFBRSxFQUFFLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxHQUFHLE9BQU87SUFDOUYsSUFBSSxPQUFPLGVBQWUs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FBRSxhQUFhLEdBQUcsQ0FBQyxFQUFFLFFBQVEsRUFBRSxNQUFNLENBQUMsQ0FBQTtnQkFDbEYsQ0FBQyxFQUNELFdBQVcsQ0FDWixDQUFBO2FBQ0Y7WUFFRCxPQUFPLFdBQVcsQ0FBQyxNQUFNLENBQUE7U0FDMUI7SUFDSCxDQUFDO0NBQ0Y7QUF0Q0QsbUNBc0NDIn0= |
{ | ||
"name": "async-retry.ts", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "async await version of co-retry.js(https://www.npmjs.com/package/co-retry.js), which can be used in both TypeScript and JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22621
183