How do folks like to do error handling in Supabase?
I'm finding I have a lot of code that looks something like:
await supabase.from('quotes') .select('*') .maybeSingle() .then(({ data, error }) => { if (error) { throw error // this part is annoying boilerplate } // do interesting stuff with data... })
await supabase.from('quotes') .select('*') .maybeSingle() .then(({ data, error }) => { if (error) { throw error // this part is annoying boilerplate } // do interesting stuff with data... })
What I'd really love to do is avoid the
{data, error}
{data, error}
destructuring, and just use the data objects, and if there's an exception, handle that in the exception path. Is there something I can be doing better?
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.