Improve error handling (#2539)

* feat: improve error handling

* fix: run renderer
This commit is contained in:
Nate Moore 2022-02-07 14:11:32 -06:00 committed by GitHub
parent 3f4d54282f
commit d9ac85ea94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}!