fix(api): log error correctly and differentiate logs (#60404)

This commit is contained in:
Oliver Eyton-Williams
2025-05-16 17:15:52 +02:00
committed by GitHub
parent fbaacd792a
commit 27b1a21384
+2 -2
View File
@@ -112,7 +112,7 @@ export const auth0Client: FastifyPluginCallbackTypebox = fp(
if (error instanceof Error && error.message === 'Invalid state') { if (error instanceof Error && error.message === 'Invalid state') {
logger.error('Auth failed: invalid state'); logger.error('Auth failed: invalid state');
} else { } else {
logger.error(error, 'Auth failed'); logger.error(error, 'Failed to get access token from Auth0');
fastify.Sentry.captureException(error); fastify.Sentry.captureException(error);
} }
// It's important _not_ to redirect to /signin here, as that could // It's important _not_ to redirect to /signin here, as that could
@@ -135,7 +135,7 @@ export const auth0Client: FastifyPluginCallbackTypebox = fp(
throw Error(msg); throw Error(msg);
} }
} catch (error) { } catch (error) {
logger.error({ error }, 'Auth failed'); logger.error(error, 'Failed to get userinfo from Auth0');
fastify.Sentry.captureException(error); fastify.Sentry.captureException(error);
return reply.redirect('/signin'); return reply.redirect('/signin');
} }