diff --git a/Common/Server/Services/MonitorService.ts b/Common/Server/Services/MonitorService.ts index 93cca4643a..c0ccbd94a5 100644 --- a/Common/Server/Services/MonitorService.ts +++ b/Common/Server/Services/MonitorService.ts @@ -67,6 +67,7 @@ import QueryOperator from "../../Types/BaseDatabase/QueryOperator"; import { FindWhere } from "../../Types/BaseDatabase/Query"; import logger from "../Utils/Logger"; import PushNotificationUtil from "../Utils/PushNotificationUtil"; +import ExceptionMessages from "../../Types/Exception/ExceptionMessages"; export class Service extends DatabaseService { public constructor() { @@ -162,11 +163,11 @@ export class Service extends DatabaseService { }); if (!monitor) { - throw new BadDataException("Monitor not found."); + throw new BadDataException(ExceptionMessages.MonitorNotFound); } if (!monitor.id) { - throw new BadDataException("Monitor id not found."); + throw new BadDataException(ExceptionMessages.MonitorNotFound); } projectId = monitor.projectId!; @@ -1389,7 +1390,7 @@ ${createdItem.description?.trim() || "No description provided."} }); if (!monitor) { - throw new BadDataException("Monitor not found."); + throw new BadDataException(ExceptionMessages.MonitorNotFound); } return (monitor.postUpdatesToWorkspaceChannels || []).filter( @@ -1419,7 +1420,7 @@ ${createdItem.description?.trim() || "No description provided."} }); if (!monitor) { - throw new BadDataException("Monitor not found."); + throw new BadDataException(ExceptionMessages.MonitorNotFound); } return monitor.name || ""; diff --git a/Common/Server/Services/WorkspaceNotificationRuleService.ts b/Common/Server/Services/WorkspaceNotificationRuleService.ts index f95d2df698..d3be71595d 100644 --- a/Common/Server/Services/WorkspaceNotificationRuleService.ts +++ b/Common/Server/Services/WorkspaceNotificationRuleService.ts @@ -49,6 +49,7 @@ import WorkspaceNotificationLog from "../../Models/DatabaseModels/WorkspaceNotif import WorkspaceNotificationLogService from "./WorkspaceNotificationLogService"; import WorkspaceNotificationStatus from "../../Types/Workspace/WorkspaceNotificationStatus"; import WorkspaceNotificationActionType from "../../Types/Workspace/WorkspaceNotificationActionType"; +import ExceptionMessages from "../../Types/Exception/ExceptionMessages"; export interface MessageBlocksByWorkspaceType { workspaceType: WorkspaceType; @@ -1911,7 +1912,7 @@ export class Service extends DatabaseService { if (!monitor) { logger.debug("Monitor not found for ID:"); logger.debug(data.notificationFor.monitorId); - throw new BadDataException("Monitor ID not found"); + throw new BadDataException(ExceptionMessages.MonitorNotFound); } const monitorLabels: Array