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?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server