Bugfix:
- Update to @tabler/icons-svelte-runes for a more 'Svente 5' experience. - Adjust error handling in load functions, plain error thrown for handling in the error handler. - Fix the warning regarding a click handler attached to an <img> on the About page - Re-organise component directory - Remove unused font declarations from global.css Features: - Add service-worker caching of FilterData API response to allow for filtering to work fully offline -
This commit is contained in:
@@ -29,34 +29,12 @@ export const load: PageLoad = async ({ fetch, url }) => {
|
||||
results: results
|
||||
};
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof ValidationError) {
|
||||
throw error(400, {
|
||||
message: e.message,
|
||||
owlCode: 'VALIDATION_ERROR'
|
||||
});
|
||||
} else if (e instanceof ApiError) {
|
||||
// Check if NO_RESULTS error, and return empty array if that is the case
|
||||
if (e.code === 'NOT_FOUND') {
|
||||
return {
|
||||
title: headcode.toUpperCase(),
|
||||
results: []
|
||||
};
|
||||
} else {
|
||||
throw error(e.status, {
|
||||
message: e.message,
|
||||
owlCode: 'API_ERROR'
|
||||
});
|
||||
}
|
||||
} else if (e instanceof Error) {
|
||||
throw error(500, {
|
||||
message: e.message,
|
||||
owlCode: 'GEN_ERROR'
|
||||
});
|
||||
} else {
|
||||
throw error(500, {
|
||||
message: 'Unexpected error',
|
||||
owlCode: 'UNKNOWN_ERR'
|
||||
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