From d9ac85ea94f8aa24cf1da80292bcacc6cefef5d0 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Mon, 7 Feb 2022 14:11:32 -0600 Subject: [PATCH] Improve error handling (#2539) * feat: improve error handling * fix: run renderer --- packages/astro/src/runtime/server/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index 6fe61d827..93c908416 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -216,6 +216,11 @@ There ${plural ? 'are' : 'is'} ${renderers.length} renderer${plural ? 's' : ''} but ${plural ? 'none were' : 'it was not'} able to server-side render ${metadata.displayName}. Did you mean to enable ${formatList(probableRendererNames.map((r) => '`' + r + '`'))}?`); + } else if (matchingRenderers.length === 1) { + // We already know that renderer.ssr.check() has failed + // but this will throw a much more descriptive error! + renderer = matchingRenderers[0]; + ({ html } = await renderer.ssr.renderToStaticMarkup(Component, props, children)); } else { throw new Error(`Unable to render ${metadata.displayName}!