Emmanuel
Emmanuel
SSolidJS
Created by Emmanuel on 4/1/2024 in #support
Idiomatic way to handle API route errors
Hi folks, Consider the following API route, using Solid Start:
export async function GET() {
const things = await fetchAllThingsFromDb();
return json(things);
}
export async function GET() {
const things = await fetchAllThingsFromDb();
return json(things);
}
If the DB throws an error, what is the idiomatic way to handle it with Solid Start instead of the default 500 response? Or is it my responsibility to wrap every DB call with a try/catch?
1 replies