From 6c5b80ad76d29273365dc803a7d0e0e323895f03 Mon Sep 17 00:00:00 2001 From: ali ebrahimi Date: Tue, 11 Jun 2024 23:35:50 +0330 Subject: [PATCH] Add error logs in routers --- src/routes/v1/notificationRouter.ts | 7 +++++++ src/routes/v1/notificationSettingsRouter.ts | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/routes/v1/notificationRouter.ts b/src/routes/v1/notificationRouter.ts index d34263e..440799a 100644 --- a/src/routes/v1/notificationRouter.ts +++ b/src/routes/v1/notificationRouter.ts @@ -5,6 +5,7 @@ import { } from '../../middlewares/authentication'; import { NotificationsController } from '../../controllers/v1/notificationsController'; import { sendStandardResponse } from '../../utils/responseUtils'; +import { logger } from '../../utils/logger'; import { createNewUserAddressIfNotExists } from '../../repositories/userAddressRepository'; export const notificationRouter = express.Router(); @@ -22,6 +23,7 @@ notificationRouter.post( }); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/thirdParty/notifications error', e); next(e); } }, @@ -41,6 +43,7 @@ notificationRouter.post( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/thirdParty/notificationsBulk error', e); next(e); } }, @@ -65,6 +68,7 @@ notificationRouter.get( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/notifications error', e); next(e); } }, @@ -85,6 +89,7 @@ notificationRouter.put( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/notifications/read/:notificationId error', e); next(e); } }, @@ -100,6 +105,7 @@ notificationRouter.get( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/notifications/countUnread/:walletAddress error', e); next(e); } }, @@ -120,6 +126,7 @@ notificationRouter.put( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/notifications/readAll error', e); next(e); } }, diff --git a/src/routes/v1/notificationSettingsRouter.ts b/src/routes/v1/notificationSettingsRouter.ts index 38924a9..d950253 100644 --- a/src/routes/v1/notificationSettingsRouter.ts +++ b/src/routes/v1/notificationSettingsRouter.ts @@ -2,6 +2,7 @@ import express, { Request, Response } from 'express'; import { validateAuthMicroserviceJwt } from '../../middlewares/authentication'; import { NotificationSettingsController } from '../../controllers/v1/notificationSettingsController'; import { sendStandardResponse } from '../../utils/responseUtils'; +import { logger } from '../../utils/logger'; export const notificationSettingsRouter = express.Router(); @@ -25,6 +26,7 @@ notificationSettingsRouter.get( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('get /notification_settings error', e); next(e); } }, @@ -47,6 +49,7 @@ notificationSettingsRouter.put( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('/notification_settings/:id error', e); next(e); } }, @@ -68,6 +71,7 @@ notificationSettingsRouter.put( ); return sendStandardResponse({ res, result }); } catch (e) { + logger.error('put /notification_settings error', e); next(e); } },