Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

fix: use _notifyException to handle recoverSession errors #131

Merged
merged 2 commits into from
Mar 29, 2023

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

Currently, the only way to listen to exceptions thrown during recoverSession is to handle SupabaseAuth.initialSession, which I think we should move away from, since it's a weird design pattern to just have a variable just for the initial session.

This PR allows users to listen to errors emitted on recoverSession by adding onError() on onAuthStateChanged. So that it is easier to handle the initial auth exceptions as well as on going exceptions happening during token refresh can be all handled through onAuthStateChanged.

Copy link
Contributor

@Vinzent03 Vinzent03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this! What about adding the stacktrace as optional argument to _notifiyException()?

@dshukertjr
Copy link
Member Author

@Vinzent03 Ah, how could I forget that 😂

@dshukertjr dshukertjr merged commit dd17d22 into main Mar 29, 2023
@dshukertjr dshukertjr deleted the fix/recover-excepction branch March 29, 2023 11:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants