Prepare changes to error code handling
This commit is contained in:
@@ -23,7 +23,7 @@ export const load: PageLoad = async ({ url }) => {
|
||||
const response = await OwlClient.trains.getByHeadcode(headcode, date, toc);
|
||||
|
||||
// Shouldn't be needed to cast the type...
|
||||
const results = (response.data || []);
|
||||
const results = (response.data);
|
||||
return {
|
||||
title: headcode.toUpperCase(),
|
||||
results: results,
|
||||
@@ -35,7 +35,8 @@ export const load: PageLoad = async ({ url }) => {
|
||||
owlCode: 'VALIDATION_ERROR',
|
||||
});
|
||||
} else if (e instanceof ApiError) {
|
||||
console.log(e);
|
||||
// Check if NO_RESULTS error, and return empty array if that is the case
|
||||
// Maybe adjust the resulting error depending on the ERROR Code?!
|
||||
throw error(20, {
|
||||
message: e.message,
|
||||
owlCode: 'API_ERROR',
|
||||
|
||||
Reference in New Issue
Block a user