Skip to content

Commit

Permalink
fix: reject with reason instead of nothing (undefined)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshah98 committed Oct 31, 2023
1 parent c76d9ec commit 36a5dce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function* withPage(percy, url, callback, retry) {
return yield* yieldTo(callback(page));
} catch (error) {
// if the page crashed and retry returns truthy, try again
if (error?.message?.includes('crashed') && retry?.()) {
if (error.message?.includes('crashed') && retry?.()) {
return yield* withPage(...arguments);
}

Expand Down Expand Up @@ -247,9 +247,9 @@ export function evalSetCurrentStory({ waitFor }, story) {
// resolve when rendered, reject on any other renderer event
return new Promise((resolve, reject) => {
channel.on('storyRendered', resolve);
channel.on('storyMissing', reject);
channel.on('storyErrored', reject);
channel.on('storyThrewException', reject);
channel.on('storyMissing', () => reject('Story Missing'));

Check failure on line 250 in src/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected the Promise rejection reason to be an Error
channel.on('storyErrored', () => reject('Story Errored'));

Check failure on line 251 in src/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected the Promise rejection reason to be an Error
channel.on('storyThrewException', () => reject('Story Threw Exception'));

Check failure on line 252 in src/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected the Promise rejection reason to be an Error
});
});
}

0 comments on commit 36a5dce

Please sign in to comment.