Skip to content

Commit

Permalink
refactor(builders): improve error message when no routes have been found
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 committed Jan 4, 2020
1 parent 42a4df3 commit f0a78c4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/builders/src/prerender/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Prerender Builder', () => {
it('fails with error when no routes are provided', async () => {
const run = await architect.scheduleTarget(target, { routes: [], guessRoutes: false });
await expectAsync(run.result).toBeRejectedWith(
jasmine.objectContaining({ message: jasmine.stringMatching(/No routes found/)})
jasmine.objectContaining({ message: jasmine.stringMatching(/Could not find any routes to prerender/)})
);
await run.stop();
});
Expand Down
2 changes: 1 addition & 1 deletion modules/builders/src/prerender/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export async function execute(
): Promise<PrerenderBuilderOutput> {
const routes = await getRoutes(options, context);
if (!routes.length) {
throw new Error('No routes found.');
throw new Error(`Could not find any routes to prerender.`);
}

const result = await _scheduleBuilds(options, context);
Expand Down
2 changes: 1 addition & 1 deletion modules/builders/src/prerender/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function getServerBundle(bundlePath: string) {
}
} catch (e) {
if (process.send) {
process.send({ success: false, error: e, outputIndexPath });
process.send({ success: false, error: e.message, outputIndexPath });
}
}
}
Expand Down

0 comments on commit f0a78c4

Please sign in to comment.