Skip to content

Proposal: throwOnError should be default behavior #885

Open
@ianschmitz

Description

@ianschmitz

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Admittedly this is not a bug, but i wanted this issue to end up in the supabase-js repo as that is where the decision would need to be made.

As a new user of the supabase-js library, i was caught off guard by the API not throwing errors by default. Instead you need to remember to invoke throwOnError() after every query. This change was previously made and discussed here: #32, and it seems others share my same concern.

This is (IMO) an unusual behavior for an API where errors are silent by default. .update() mutations that fail can easily go unnoticed for example.

Other popular libraries i use on a regular basis such as Prisma, Zod, etc. instead throw by default, and you either have to catch the error, or opt into the API that doesn't throw and returns an error object (see Zod docs for example).

cc @n-sviridenko, @rienheuver

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions