Skip to content

Commit c3daee5

Browse files
committedMar 20, 2025
fix(@angular/build): correct handling of response/request errors
Prior to this change, request errors were not handled correctly. Closes angular#29884
1 parent 5169f21 commit c3daee5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎packages/angular/build/src/utils/server-rendering/launch-server.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ export async function launchServer(): Promise<URL> {
3333
// handle request
3434
if (isSsrNodeRequestHandler(reqHandler)) {
3535
await reqHandler(req, res, (e) => {
36-
throw e;
36+
res.statusCode = 500;
37+
res.end('Internal Server Error.');
38+
if (e) {
39+
// eslint-disable-next-line no-console
40+
console.error(e);
41+
}
3742
});
3843
} else {
3944
const webRes = await reqHandler(createWebRequestFromNodeRequest(req));

0 commit comments

Comments
 (0)
Failed to load comments.