bug fixes

This commit is contained in:
Christian Beutel
2025-01-03 18:59:10 +01:00
parent 46b5b94219
commit 72d2bf6062
17 changed files with 1140 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
import { trails_show } from "$lib/stores/trail_store";
import { APIError } from "$lib/util/api_util";
import { error, type Load } from "@sveltejs/kit";
import { error, type Load, type NumericRange } from "@sveltejs/kit";
export const load: Load = async ({ params, fetch }) => {
try {
@@ -8,9 +8,9 @@ export const load: Load = async ({ params, fetch }) => {
return { trail }
} catch (e) {
if (e instanceof APIError && e.status == 404) {
error(404, {
message: 'Not found'
if (e instanceof APIError) {
error(e.status as NumericRange<400, 599>, {
message: e.status == 404 ? 'Not found' : e.message
});
}
console.log(e);