Skip to content

Commit

Permalink
Merge pull request #148 from rackspace/issue/146-expiring-value-cache…
Browse files Browse the repository at this point in the history
…-fix

Issue #146 Avoid uncaught exception when handling failure case in expiring-value
  • Loading branch information
kernwig authored Dec 3, 2024
2 parents b39cc70 + 8c5d314 commit 4ad7777
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions expiring-value/lib/expiring-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export class ExpiringValue<T> {
if (this.options.cacheError) {
this.extendExpiration();
} else {
// Update expiration, only upon success
this.value.then(() => this.extendExpiration());
// Update expiration, only upon success; no-op on error here
this.value.then(() => this.extendExpiration()).catch(() => undefined);
}
}

Expand Down
2 changes: 1 addition & 1 deletion expiring-value/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"scripts": {
"build": "tsc && npm link && cp dist/expiring-value.d.ts ../docs/types/",
"test": "NODE_OPTIONS=--unhandled-rejections=none jest",
"test": "jest",
"test:watch": "jest --watch",
"clean:publish": "rm -r dist; npm run build && npm publish --access public"
},
Expand Down

0 comments on commit 4ad7777

Please sign in to comment.