Fix error handling
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
911aa113ea
commit
d95ed436b8
@ -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"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user