Error handling bugfix: pass #1

This commit is contained in:
2026-10-02 07:04:22 +01:00
parent 39a5e91eeb
commit d8ea4f8e02
53 changed files with 1179 additions and 410 deletions
@@ -185,10 +185,19 @@ export default async function genWebHTML({
console.debug = () => {};
let htmlBody: string;
let render_error: any;
let has_render_error = false;
try {
const stream = await renderToReadableStream(final_component, {
onError(error: any) {
if (error.message.includes('unique "key" prop')) return;
if (error?.message?.includes('unique "key" prop')) return;
if (!has_render_error) {
has_render_error = true;
render_error = error;
}
originalConsole.error(error);
},
});
@@ -198,6 +207,13 @@ export default async function genWebHTML({
Object.assign(console, originalConsole);
}
// A component crash during SSR must surface as a proper error (handled
// upstream as a 500 page). React only reports these to `onError`; without
// rethrowing, the user gets a 200 with broken/blank markup.
if (has_render_error) {
throw render_error;
}
html += htmlBody;
return html;