Skip to content

Commit

Permalink
fix(liveslots): promise watcher to cause unhandled rejection if no ha…
Browse files Browse the repository at this point in the history
…ndler (#9507)

refs: #8596

## Description

Reverts a behavioral change questioned in #8596 (comment), which was indeed not appropriate.

If the reject handler is missing, it should result in an unhandled rejection.

### Security Considerations
None

### Scaling Considerations
None

### Documentation Considerations
None

### Testing Considerations
No coverage

### Upgrade Considerations
Maintains currently deployed behavior on mainnet
  • Loading branch information
mhofman authored Jun 14, 2024
1 parent 249a5d4 commit a19a964
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/swingset-liveslots/src/watchedPromises.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,15 @@ export function makeWatchedPromiseManager({
function providePromiseWatcher(
kindHandle,
// @ts-expect-error xxx rest params in typedef
fulfillHandler = _value => {},
fulfillHandler = _value => {
// It's fine to not pass the value through since promise watchers are not chainable
},
// @ts-expect-error xxx rest params in typedef
rejectHandler = _reason => {},
rejectHandler = reason => {
// Replicate the unhandled rejection that would have happened if the
// watcher had not implemented an `onRejected` method. See `settle` above
throw reason;
},
) {
assert.typeof(fulfillHandler, 'function');
assert.typeof(rejectHandler, 'function');
Expand Down

0 comments on commit a19a964

Please sign in to comment.