💬 Question here
There seems to be no way to crash the server from the error handler as it will simply catch the error and try to send it as a response. I would like to respond to the request that an error occured and then crash the server because it might be in an undefined state.
const fastify = require('fastify').default;
const f = fastify({
logger: true,
});
f.setErrorHandler((error, request, response) => {
// The expected errors will be handled here, but unexpected ones should eventually result in a crash.
response.send({ error: true });
throw new Error('should crash');
});
f.get('/test', () => {
const p = null;
return p.oops;
});
f.listen(3000, '0.0.0.0');
My goal is to crash the server for any error that I wasn't expecting. Those that I did will be handled gracefully.
Your Environment
- node version: 14
- fastify version: 3.7.0
- os: Linux
💬 Question here
There seems to be no way to crash the server from the error handler as it will simply catch the error and try to send it as a response. I would like to respond to the request that an error occured and then crash the server because it might be in an undefined state.
My goal is to crash the server for any error that I wasn't expecting. Those that I did will be handled gracefully.
Your Environment