mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): log error correctly and differentiate logs (#60404)
This commit is contained in:
committed by
GitHub
parent
fbaacd792a
commit
27b1a21384
@@ -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');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user