fix: add error logging to empty catch blocks

This commit is contained in:
Kirill
2026-05-27 20:17:05 +05:00
parent 8f3bd7aa3b
commit f6414adf2f
26 changed files with 1590 additions and 34 deletions
+5 -3
View File
@@ -51,11 +51,12 @@ await fastify.register(cors, {
await registerSecurityHeaders(fastify)
fastify.get('/health', async () => {
fastify.get('/health', async (request) => {
try {
await prisma.$queryRaw`SELECT 1`
return { status: 'ok', database: 'connected', uptime: process.uptime() }
} catch {
} catch (err) {
request.log.error({ err }, 'Health check database query failed')
return { status: 'degraded', database: 'disconnected', uptime: process.uptime() }
}
})
@@ -119,7 +120,8 @@ fastify.decorate('authenticate', async function authenticate(request, reply) {
request.headers.authorization = `Bearer ${request.query.token}`
}
await request.jwtVerify()
} catch {
} catch (err) {
request.log.error({ err }, 'JWT verification failed')
return reply.code(401).send({ error: 'Не авторизован' })
}
})