Improve +error.svelte handling
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user