From d95ed436b82fc518ef0227fa9b79e914a5c41395 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 20 Sep 2023 20:20:55 +0100 Subject: [PATCH] Fix error handling Signed-off-by: Fred Boniface --- src/services/ldb.services.js | 2 +- src/utils/translators/ldb/staffStation.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/services/ldb.services.js b/src/services/ldb.services.js index 1f83126..351f639 100644 --- a/src/services/ldb.services.js +++ b/src/services/ldb.services.js @@ -31,7 +31,7 @@ async function get(id, staff = false) { log.out(`ldbService.get: Error, Unable to find CRS: ${err}`, "info"); return { obStatus: "LOC_NOT_FOUND", - obMsg: msgCodes.get(this.obStatus), + obMsg: msgCodes.get("LOC_NOT_FOUND"), }; } } diff --git a/src/utils/translators/ldb/staffStation.ts b/src/utils/translators/ldb/staffStation.ts index dddfe8b..9011a84 100644 --- a/src/utils/translators/ldb/staffStation.ts +++ b/src/utils/translators/ldb/staffStation.ts @@ -36,12 +36,12 @@ export function transform(input: any): StaffLdb | null { } function transformDateTime(input: string): Date { - console.log("Transform Date Time Running") + //console.log("Transform Date Time Running") return new Date(input); } function transformNrcc(input: any): NrccMessage[] | undefined { - console.log("Transform Nrcc Running") + //console.log("Transform Nrcc Running") if (input === undefined) { return input } @@ -64,7 +64,7 @@ function transformNrcc(input: any): NrccMessage[] | undefined { } function transformTrainServices(input: any): TrainServices[] { - console.log("Transform Train Services Running") + //console.log("Transform Train Services Running") let services: any = input?.service; let output: TrainServices[] = []; if (services === undefined) { @@ -107,7 +107,7 @@ function transformTrainServices(input: any): TrainServices[] { } function transformLocation(input: any): ServiceLocation[] { - console.log("Transform Location Running") + //console.log("Transform Location Running") let output: ServiceLocation[] = []; let locations: any[] = input.location; if (!Array.isArray(input.location)) { @@ -126,7 +126,7 @@ function transformLocation(input: any): ServiceLocation[] { } export function calculateLength(input: any): number | undefined { - console.log("Calculate Length Running") + //console.log("Calculate Length Running") let length: number; if (input?.length) { length = input.length; @@ -140,7 +140,7 @@ export function calculateLength(input: any): number | undefined { } function transformUnspecifiedDateTime(input: string): Date | undefined { - console.log("Transform Unspecified Date Time Running") + //console.log("Transform Unspecified Date Time Running") if (!input) { return undefined; }