Skip to content

Commit

Permalink
Wrap some calls in try/catch in AuthManager.cs (#263)
Browse files Browse the repository at this point in the history
- Added Try/Catch to AuthManager requests
  • Loading branch information
hawkwood authored May 1, 2024
1 parent 3fdf126 commit 0c85044
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Runtime/AvatarCreator/Scripts/Managers/AuthManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ public static void SetUser(UserSession session)

public static async void SendEmailCode(string email)
{
await AuthAPIRequests.SendCodeToEmail(email, userSession.Id);
try
{
await AuthAPIRequests.SendCodeToEmail(email, userSession.Id);
}
catch (Exception e)
{
OnSignInError?.Invoke(e.Message);
}
}

public static async Task<bool> LoginWithCode(string otp, string userIdToMerge = null)
Expand All @@ -63,7 +70,14 @@ public static async Task<bool> LoginWithCode(string otp, string userIdToMerge =

public static async void Signup(string email)
{
await AuthAPIRequests.Signup(email, userSession.Id);
try
{
await AuthAPIRequests.Signup(email, userSession.Id);
}
catch (Exception e)
{
OnSignInError?.Invoke(e.Message);
}
}

public static async Task RefreshToken()
Expand Down

0 comments on commit 0c85044

Please sign in to comment.