feat: Manejar errores en la respuesta del servidor con código de estado 500 y mensaje JSON
This commit is contained in:
@@ -1498,6 +1498,15 @@ export const server = createServer(
|
||||
res.end(JSON.stringify({ ok: false, error: String(err) }));
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
res.writeHead(
|
||||
500,
|
||||
applySecurityHeadersForRequest(req, {
|
||||
"Content-Type": "application/json",
|
||||
})
|
||||
);
|
||||
res.end(JSON.stringify({ ok: false, error: String(err) }));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user