From 36a5dcedf51048f4e78816afc43dfbec514d5915 Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Tue, 31 Oct 2023 21:03:22 +0530 Subject: [PATCH] fix: reject with reason instead of nothing (undefined) --- src/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils.js b/src/utils.js index f8d428c6..3ae765f6 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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); } @@ -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')); + channel.on('storyErrored', () => reject('Story Errored')); + channel.on('storyThrewException', () => reject('Story Threw Exception')); }); }); }