Skip to content

Commit

Permalink
feat: simplifying error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
4lejandrito committed Oct 10, 2023
1 parent 8046c40 commit 2075683
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/find-stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export default async function findStories(
}),
);
if (stories.length === 0) {
console.log(`No story files (${pattern}) found`);
process.exit(0);
throw `No story files (${pattern}) found`;
}
if (options?.all) {
return stories;
Expand Down
3 changes: 1 addition & 2 deletions lib/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default async function run(
}
} catch (err: any) {
console.log(picocolors.red("✘"), story.name, response?.status ?? "");
console.error(response ? err.message : err);
process.exit(1);
throw response ? err.message : err;
}
}
console.log(
Expand Down

0 comments on commit 2075683

Please sign in to comment.