Skip to content

Commit

Permalink
Add an error message for improperly configured renderers (#4705)
Browse files Browse the repository at this point in the history
* Add error messages for wrongly configured renderers

* Add changeset
  • Loading branch information
Princesseuh committed Sep 12, 2022
1 parent ee03967 commit 5b6173f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-rats-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Properly show an error message when a renderer is not properly configured
8 changes: 8 additions & 0 deletions packages/astro/src/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ export async function runHookConfigSetup({
config: updatedConfig,
command,
addRenderer(renderer: AstroRenderer) {
if (!renderer.name) {
throw new Error(`Integration ${bold(integration.name)} has an unnamed renderer.`);
}

if (!renderer.serverEntrypoint) {
throw new Error(`Renderer ${bold(renderer.name)} does not provide a serverEntrypoint.`);
}

updatedConfig._ctx.renderers.push(renderer);
},
injectScript: (stage, content) => {
Expand Down

0 comments on commit 5b6173f

Please sign in to comment.