From c929febf4f55ab402142cbca3b3b58332dd71ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6khan=20Bulut?= Date: Fri, 25 Oct 2024 01:55:14 +0300 Subject: [PATCH] refactor: error logging in authentication system (#105) --- server/src/routes/auth/callback.js | 2 +- server/src/utils/middlewares/checkAuthentication.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/routes/auth/callback.js b/server/src/routes/auth/callback.js index 4711732c..1ed12fa0 100644 --- a/server/src/routes/auth/callback.js +++ b/server/src/routes/auth/callback.js @@ -106,7 +106,7 @@ module.exports = { return response.redirect(redirectCookie || config.frontendUrl); } catch (error) { - logger.error(`There was an error while getting access token: ${error}`); + logger.error('There was an error while getting access token:', error); return response.sendError('Failed to get access token.', 500); } diff --git a/server/src/utils/middlewares/checkAuthentication.js b/server/src/utils/middlewares/checkAuthentication.js index bb005d29..af02f546 100644 --- a/server/src/utils/middlewares/checkAuthentication.js +++ b/server/src/utils/middlewares/checkAuthentication.js @@ -34,7 +34,7 @@ module.exports = async function checkAuthentication(request, response, next) { if (error instanceof AuthError) return response.sendError(error.message, 401); - logger.error(`There was an error while checking authentication: ${error}`); + logger.error('There was an error while checking authentication:', error); return response.sendError('An error occurred while checking authentication.', 500); }