Improve +error.svelte handling

This commit is contained in:
2026-05-16 19:19:31 +01:00
parent b51845528f
commit 07579310b2
4 changed files with 43 additions and 27 deletions

View File

@@ -12,7 +12,7 @@ export const load: PageLoad = async ({ url, fetch }) => {
if (!locId) {
error(400, {
message: 'Location not provided',
owlCode: 'NO_LOCATION_IN_PATH'
code: 'VALIDATION'
});
}
@@ -21,7 +21,7 @@ export const load: PageLoad = async ({ url, fetch }) => {
if (!BoardLocation) {
error(404, {
message: `Location (${locId.toUpperCase()}) not found`,
owlCode: 'INVALID_LOCATION_CODE'
code: 'VALIDATION'
});
}
const title = BoardLocation.n || BoardLocation.t || 'Live Arr/Dep';
@@ -35,12 +35,6 @@ export const load: PageLoad = async ({ url, fetch }) => {
boardData
};
} catch (e: unknown) {
if (e instanceof TypeError && e.message === 'Failed to fetch') {
error(503, {
message: 'Cannot connect to the OwlBoard server',
owlCode: 'NETWORK_DISCONNECTED'
});
}
throw e;
}
};