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");
|
log.out(`ldbService.get: Error, Unable to find CRS: ${err}`, "info");
|
||||||
return {
|
return {
|
||||||
obStatus: "LOC_NOT_FOUND",
|
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 {
|
function transformDateTime(input: string): Date {
|
||||||
console.log("Transform Date Time Running")
|
//console.log("Transform Date Time Running")
|
||||||
return new Date(input);
|
return new Date(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformNrcc(input: any): NrccMessage[] | undefined {
|
function transformNrcc(input: any): NrccMessage[] | undefined {
|
||||||
console.log("Transform Nrcc Running")
|
//console.log("Transform Nrcc Running")
|
||||||
if (input === undefined) {
|
if (input === undefined) {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ function transformNrcc(input: any): NrccMessage[] | undefined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function transformTrainServices(input: any): TrainServices[] {
|
function transformTrainServices(input: any): TrainServices[] {
|
||||||
console.log("Transform Train Services Running")
|
//console.log("Transform Train Services Running")
|
||||||
let services: any = input?.service;
|
let services: any = input?.service;
|
||||||
let output: TrainServices[] = [];
|
let output: TrainServices[] = [];
|
||||||
if (services === undefined) {
|
if (services === undefined) {
|
||||||
@ -107,7 +107,7 @@ function transformTrainServices(input: any): TrainServices[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function transformLocation(input: any): ServiceLocation[] {
|
function transformLocation(input: any): ServiceLocation[] {
|
||||||
console.log("Transform Location Running")
|
//console.log("Transform Location Running")
|
||||||
let output: ServiceLocation[] = [];
|
let output: ServiceLocation[] = [];
|
||||||
let locations: any[] = input.location;
|
let locations: any[] = input.location;
|
||||||
if (!Array.isArray(input.location)) {
|
if (!Array.isArray(input.location)) {
|
||||||
@ -126,7 +126,7 @@ function transformLocation(input: any): ServiceLocation[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function calculateLength(input: any): number | undefined {
|
export function calculateLength(input: any): number | undefined {
|
||||||
console.log("Calculate Length Running")
|
//console.log("Calculate Length Running")
|
||||||
let length: number;
|
let length: number;
|
||||||
if (input?.length) {
|
if (input?.length) {
|
||||||
length = input.length;
|
length = input.length;
|
||||||
@ -140,7 +140,7 @@ export function calculateLength(input: any): number | undefined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function transformUnspecifiedDateTime(input: string): Date | undefined {
|
function transformUnspecifiedDateTime(input: string): Date | undefined {
|
||||||
console.log("Transform Unspecified Date Time Running")
|
//console.log("Transform Unspecified Date Time Running")
|
||||||
if (!input) {
|
if (!input) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user