Prepare changes to error code handling

This commit is contained in:
2026-04-28 17:45:59 +01:00
parent 5bbffcecb8
commit 16d929fad1
2 changed files with 4 additions and 2 deletions

View File

@@ -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',