Skip to content

Support throwing errors instead of returning them #1688

@soedirgo

Description

@soedirgo

Feature request

Describe the feature

Add a throwOnError client option to have errors be thrown instead of returning it. As an example, right now we do:

const auth = new AuthClient({ url: AUTH_URL })
const { data, error } = await auth.signUp({ email: 'myemail@example.com', password: 'foobar' })

But with throwOnError we do:

const auth = new AuthClient({ url: AUTH_URL, throwOnError: true })
const { data } = await auth.signUp({ email: 'myemail@example.com', password: 'foobar' })

Additional context

Follows supabase/postgrest-js#188 & supabase/postgrest-js#248

Metadata

Metadata

Assignees

No one assigned

    Labels

    auth-jsRelated to the auth-js library.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions