Fix: PR comments
This commit is contained in:
1 parent
22b33d789c
commit
ea086d6956
2 files changed
+6
-3
No files matched your search
@@ -352,6 +352,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
|||||||
tempAlertCounter: doc.tempAlertCounter,
|
tempAlertCounter: doc.tempAlertCounter,
|
||||||
selectedDisks: doc.selectedDisks ?? [],
|
selectedDisks: doc.selectedDisks ?? [],
|
||||||
gameId: doc.gameId ?? undefined,
|
gameId: doc.gameId ?? undefined,
|
||||||
|
grpcServiceName: doc.grpcServiceName ?? undefined,
|
||||||
group: doc.group ?? null,
|
group: doc.group ?? null,
|
||||||
recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)),
|
recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)),
|
||||||
createdAt: toDateString(doc.createdAt),
|
createdAt: toDateString(doc.createdAt),
|
||||||
@@ -407,6 +408,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
|||||||
tempAlertCounter: doc.tempAlertCounter,
|
tempAlertCounter: doc.tempAlertCounter,
|
||||||
selectedDisks: doc.selectedDisks ?? [],
|
selectedDisks: doc.selectedDisks ?? [],
|
||||||
gameId: doc.gameId ?? undefined,
|
gameId: doc.gameId ?? undefined,
|
||||||
|
grpcServiceName: doc.grpcServiceName ?? undefined,
|
||||||
group: doc.group ?? null,
|
group: doc.group ?? null,
|
||||||
recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)),
|
recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)),
|
||||||
createdAt: toDateString(doc.createdAt),
|
createdAt: toDateString(doc.createdAt),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { HTTPError, RequestError } from "got";
|
import { HTTPError, RequestError } from "got";
|
||||||
import type { Got, Response } from "got";
|
import type { Got, Response } from "got";
|
||||||
import type { Monitor, MonitorStatusResponse, GrpcStatusPayload } from "@/types/index.js";
|
import type { Monitor, MonitorStatusResponse, GrpcStatusPayload } from "@/types/index.js";
|
||||||
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
@@ -644,10 +645,10 @@ class NetworkService implements INetworkService {
|
|||||||
const grpcServiceName = monitor.grpcServiceName || "";
|
const grpcServiceName = monitor.grpcServiceName || "";
|
||||||
|
|
||||||
if (!url) {
|
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) {
|
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}`;
|
const target = `${url}:${port}`;
|
||||||
@@ -700,7 +701,7 @@ class NetworkService implements INetworkService {
|
|||||||
serviceName: grpcServiceName,
|
serviceName: grpcServiceName,
|
||||||
servingStatus: "UNKNOWN",
|
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).grpcPayload = payload;
|
||||||
(grpcError as any).grpcCode = err.code;
|
(grpcError as any).grpcCode = err.code;
|
||||||
reject(grpcError);
|
reject(grpcError);
|
||||||
|
|||||||
Reference in new issue
Block a user