Error handling in Supabase

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...
    })


What I'd really love to do is avoid the {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?
Was this page helpful?