Skip to content

Conversation

@mandarini
Copy link
Contributor

@mandarini mandarini commented Oct 10, 2025

Moved from: supabase/auth-js#1022
Author: @kiwicopple

Fixes #1688

Add support for throwOnError option in AuthClient to throw errors instead of returning them.

  • GoTrueClient Changes:

    • Add throwOnError option to GoTrueClient constructor.
    • Modify methods to throw errors when throwOnError is true.
    • Update methods like signUp, signInWithPassword, updateUser, and others to throw errors if throwOnError is true.
  • AuthClient Changes:

    • Update AuthClient to pass throwOnError option to GoTrueClient.
  • Tests:

    • Add tests in test/GoTrueClient.test.ts to verify throwOnError functionality.

Other changes

Replace ConstructorParameters type extraction with direct import of GoTrueClientOptions:

// Before
type AuthClientOptions = ConstructorParameters<typeof AuthClient>[0]
export interface SupabaseAuthClientOptions extends AuthClientOptions {}

// After
import { GoTrueClientOptions } from '@supabase/auth-js'
export interface SupabaseAuthClientOptions extends GoTrueClientOptions {}

This was introduced because ConstructorParameters wasn't resolving properly across package boundaries. Direct type extension is more explicit and ensures all auth-js properties are recognized.

@mandarini mandarini requested review from a team as code owners October 10, 2025 14:51
@mandarini mandarini requested a review from hf October 10, 2025 14:51
@mandarini mandarini added the auth-js Related to the auth-js library. label Oct 13, 2025
@mandarini mandarini added do-not-merge Do not merge this PR. and removed do-not-merge Do not merge this PR. labels Oct 30, 2025
@mandarini mandarini force-pushed the kiwicopple/add-throwOnError branch from 1ea1aa2 to 9c6aecd Compare October 30, 2025 13:14
@coveralls
Copy link

coveralls commented Oct 30, 2025

Coverage Status

coverage: 95.455% (-0.5%) from 95.987%
when pulling 7a7da62 on kiwicopple/add-throwOnError
into ec5a976 on master.

@mandarini mandarini requested a review from a team as a code owner October 30, 2025 14:13
@mandarini mandarini force-pushed the kiwicopple/add-throwOnError branch from 2839f80 to b24ff82 Compare October 30, 2025 14:20
@mandarini mandarini force-pushed the kiwicopple/add-throwOnError branch from b24ff82 to 7a7da62 Compare October 30, 2025 14:34
hf
hf previously approved these changes Oct 30, 2025
@mandarini mandarini removed the request for review from a team October 30, 2025 14:49
o-santi
o-santi previously approved these changes Oct 30, 2025
@mandarini mandarini self-assigned this Oct 30, 2025
@mandarini mandarini dismissed stale reviews from o-santi and hf via aa8aeea October 30, 2025 15:28
@mandarini mandarini requested review from hf and o-santi October 30, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth-js Related to the auth-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support throwing errors instead of returning them

7 participants