Skip to content

Commit

Permalink
Merge pull request #30285 from storybookjs/yann/fix-undefined-error-m…
Browse files Browse the repository at this point in the history
…essage

Build: Fix task error message when no key is specified
  • Loading branch information
yannbf authored Jan 17, 2025
2 parents c2568ec + 96f7cef commit 3e64ed0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@ async function run() {
}
} catch (err) {
invariant(err instanceof Error);
logger.error(
`Error running task ${picocolors.bold(getTaskKey(task))} for ${picocolors.bgCyan(picocolors.white(details.key))}:`
);
let errorTitle = `Error running task ${picocolors.bold(getTaskKey(task))}`;
if (details.key) {
errorTitle += ` for ${picocolors.bgCyan(picocolors.white(details.key))}:`;
}
logger.error(errorTitle);
logger.error(JSON.stringify(err, null, 2));

if (process.env.CI) {
Expand Down

0 comments on commit 3e64ed0

Please sign in to comment.