Skip to content

Commit

Permalink
fix(@angular/build): show error message when error stack is undefined
Browse files Browse the repository at this point in the history
Handle cases where the error stack is missing by displaying a relevant message.

Closes #28740
  • Loading branch information
alan-agius4 committed Oct 30, 2024
1 parent fee914e commit 87ec15b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ async function renderPages(
}
})
.catch((err) => {
errors.push(`An error occurred while prerendering route '${route}'.\n\n${err.stack}`);
errors.push(
`An error occurred while prerendering route '${route}'.\n\n${err.stack ?? err.message ?? err.code ?? err}`,
);
void renderWorker.destroy();
});

Expand Down Expand Up @@ -292,7 +294,9 @@ async function getAllRoutes(
const { routes: extractedRoutes, warnings }: RoutersExtractorWorkerResult = await renderWorker
.run({})
.catch((err) => {
errors.push(`An error occurred while extracting routes.\n\n${err.stack}`);
errors.push(
`An error occurred while extracting routes.\n\n${err.stack ?? err.message ?? err.code ?? err}`,
);
})
.finally(() => {
void renderWorker.destroy();
Expand Down

0 comments on commit 87ec15b

Please sign in to comment.