Fix error handling

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-20 20:20:55 +01:00
parent 911aa113ea
commit d95ed436b8
2 changed files with 7 additions and 7 deletions

View File

@ -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"),
};
}
}

View File

@ -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;
}