Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function getStorybook() {
const url = `${baseUrl}/iframe.html`;
try {
const tab = await launchStoriesTab(url);
return tab.executeFunctionWithWindow(getStories);
} catch (rawError) {
const error = unwrapError(rawError);
if (
error instanceof TimeoutError ||
(error instanceof FetchingURLsError && error.failedURLs.includes(url))
) {
throw new ServerError(
'Failed fetching stories because the server is down',
`Try starting it with "yarn storybook" or pass the --port or --host arguments if it's not running at ${baseUrl}`
);
}
throw error;
}
}