The documentation in just says to create a +page.ts file of
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ fetch, params }) => {
const res = await fetch(`/api/items/${params.id}`);
const item = await res.json();
return { item };
};
but it doesn't include any form of error handling. In vanilla JS, I will have to throw and catch with fetch, but in Svelte I am unable to find the necessary syntax and similar information.
try/catch? Or where and how do you intend to handle the error?dr-fetch(my creation), the only fetch wrapper in the world that can type the response body according to the HTTP response that it receives.