From ea086d6956b45cd42c0beaaca984ee86d990441c Mon Sep 17 00:00:00 2001 From: Br0wnHammer Date: Mon, 23 Feb 2026 10:19:42 +0530 Subject: [PATCH] Fix: PR comments --- .../src/repositories/monitors/MongoMonitorsRepository.ts | 2 ++ server/src/service/infrastructure/networkService.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/repositories/monitors/MongoMonitorsRepository.ts b/server/src/repositories/monitors/MongoMonitorsRepository.ts index 4ae4394d4..5373e6c48 100644 --- a/server/src/repositories/monitors/MongoMonitorsRepository.ts +++ b/server/src/repositories/monitors/MongoMonitorsRepository.ts @@ -352,6 +352,7 @@ class MongoMonitorsRepository implements IMonitorsRepository { tempAlertCounter: doc.tempAlertCounter, selectedDisks: doc.selectedDisks ?? [], gameId: doc.gameId ?? undefined, + grpcServiceName: doc.grpcServiceName ?? undefined, group: doc.group ?? null, recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)), createdAt: toDateString(doc.createdAt), @@ -407,6 +408,7 @@ class MongoMonitorsRepository implements IMonitorsRepository { tempAlertCounter: doc.tempAlertCounter, selectedDisks: doc.selectedDisks ?? [], gameId: doc.gameId ?? undefined, + grpcServiceName: doc.grpcServiceName ?? undefined, group: doc.group ?? null, recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)), createdAt: toDateString(doc.createdAt), diff --git a/server/src/service/infrastructure/networkService.ts b/server/src/service/infrastructure/networkService.ts index fa718e787..4b7cf938f 100644 --- a/server/src/service/infrastructure/networkService.ts +++ b/server/src/service/infrastructure/networkService.ts @@ -1,6 +1,7 @@ import { HTTPError, RequestError } from "got"; import type { Got, Response } from "got"; import type { Monitor, MonitorStatusResponse, GrpcStatusPayload } from "@/types/index.js"; +import { AppError } from "@/utils/AppError.js"; import path from "path"; import { fileURLToPath } from "url"; @@ -644,10 +645,10 @@ class NetworkService implements INetworkService { const grpcServiceName = monitor.grpcServiceName || ""; if (!url) { - throw new Error("Monitor host is required"); + throw new AppError({ message: "Monitor host is required", service: this.SERVICE_NAME, method: "requestGrpc" }); } if (!port) { - throw new Error("Monitor port is required"); + throw new AppError({ message: "Monitor port is required", service: this.SERVICE_NAME, method: "requestGrpc" }); } const target = `${url}:${port}`; @@ -700,7 +701,7 @@ class NetworkService implements INetworkService { serviceName: grpcServiceName, servingStatus: "UNKNOWN", }; - const grpcError = new Error(err.details || err.message); + const grpcError = new AppError({ message: err.details || err.message, service: this.SERVICE_NAME, method: "requestGrpc" }); (grpcError as any).grpcPayload = payload; (grpcError as any).grpcCode = err.code; reject(grpcError);