Skip to content

Commit

Permalink
Merge pull request #234 from storybookjs/prerelease
Browse files Browse the repository at this point in the history
Fix target url in error feedback
  • Loading branch information
yannbf committed Dec 20, 2022
2 parents 946da55 + da8ba2d commit aec779f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/setup-page.ts
Expand Up @@ -23,7 +23,8 @@ const sanitizeURL = (url: string) => {
};

export const setupPage = async (page: Page) => {
const targetURL = new URL('iframe.html', process.env.TARGET_URL).toString();
const targetURL = process.env.TARGET_URL;

const viewMode = process.env.VIEW_MODE || 'story';
const renderedEvent = viewMode === 'docs' ? 'docsRendered' : 'storyRendered';
const { packageJson } = await readPackageUp();
Expand All @@ -40,7 +41,8 @@ export const setupPage = async (page: Page) => {
);
}

await page.goto(targetURL, { waitUntil: 'load' }).catch((err) => {
const iframeURL = new URL('iframe.html', process.env.TARGET_URL).toString();
await page.goto(iframeURL, { waitUntil: 'load' }).catch((err) => {
if (err.message?.includes('ERR_CONNECTION_REFUSED')) {
const errorMessage = `Could not access the Storybook instance at ${targetURL}. Are you sure it's running?\n\n${err.message}`;
throw new Error(errorMessage);
Expand Down

0 comments on commit aec779f

Please sign in to comment.