From 16d929fad1fc858a931bedcbbf7aec2a6602d8be Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 28 Apr 2026 17:45:59 +0100 Subject: [PATCH] Prepare changes to error code handling --- src/routes/+error.svelte | 1 + src/routes/trains/+page.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte index 3f311d1..705d615 100644 --- a/src/routes/+error.svelte +++ b/src/routes/+error.svelte @@ -8,6 +8,7 @@
{#if page.status == 20} + {:else} diff --git a/src/routes/trains/+page.ts b/src/routes/trains/+page.ts index a48ff0d..95c67d1 100644 --- a/src/routes/trains/+page.ts +++ b/src/routes/trains/+page.ts @@ -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',