0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
Arsh 2023-12-29 15:49:10 +00:00 committed by astrobot-houston
parent 7b586a6e23
commit af59b83162

View file

@ -62,7 +62,12 @@ export default function (app: NodeApp, mode: Options['mode']) {
};
}
async function writeWebResponse(app: NodeApp, res: ServerResponse, webResponse: Response, logger: AstroIntegrationLogger) {
async function writeWebResponse(
app: NodeApp,
res: ServerResponse,
webResponse: Response,
logger: AstroIntegrationLogger
) {
const { status, headers, body } = webResponse;
if (app.setCookieHeaders) {
@ -84,8 +89,10 @@ async function writeWebResponse(app: NodeApp, res: ServerResponse, webResponse:
// Cancelling the reader may reject not just because of
// an error in the ReadableStream's cancel callback, but
// also because of an error anywhere in the stream.
reader.cancel().catch(err => {
logger.error(`There was an uncaught error in the middle of the stream while rendering ${res.req.url}.`);
reader.cancel().catch((err) => {
logger.error(
`There was an uncaught error in the middle of the stream while rendering ${res.req.url}.`
);
console.error(err);
});
});
@ -94,7 +101,7 @@ async function writeWebResponse(app: NodeApp, res: ServerResponse, webResponse:
res.write(result.value);
result = await reader.read();
}
// the error will be logged by the "on end" callback above
// the error will be logged by the "on end" callback above
} catch {
res.write('Internal server error');
}