diff --git a/src/plugins/error.handler.ts b/src/plugins/error.handler.ts index e69a4fc..07f5e24 100644 --- a/src/plugins/error.handler.ts +++ b/src/plugins/error.handler.ts @@ -25,8 +25,9 @@ export default fastifyPlugin(async (fastify: FastifyInstance) => { statusCode: 400, }); } + const statusCode = error.statusCode ?? 500; - return reply.status(error.statusCode ?? 500).send({ + return reply.status(statusCode).send({ error: error.name, errors: { _: [error.message] }, statusCode: error.statusCode,