Skip to content

Option to have supabase client throw error instead of returning it #604

Answered by mstade
mstade asked this question in Feature Requests
Discussion options

You must be logged in to vote

Hi @pppdns! Yes, I contributed the throwOnError option some time ago: supabase/postgrest-js#188

Essentially just tack on .throwOnError() to the end of any query and it should reject the promise if there's an error. Here's an example:

  // Store image caption in Database table
  await supabaseAdminClient
    .from('image_caption')
    .insert({ id: soRecord.id!, caption: imgDesc.generated_text })
    .throwOnError()

Source: https://supabase.com/docs/guides/ai/examples/huggingface-image-captioning

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mstade
Comment options

Answer selected by mstade
@pppdns
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants