Skip to content

Commit 0c85044

Browse files
authored
Wrap some calls in try/catch in AuthManager.cs (#263)
- Added Try/Catch to AuthManager requests
1 parent 3fdf126 commit 0c85044

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Runtime/AvatarCreator/Scripts/Managers/AuthManager.cs

+16-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ public static void SetUser(UserSession session)
4242

4343
public static async void SendEmailCode(string email)
4444
{
45-
await AuthAPIRequests.SendCodeToEmail(email, userSession.Id);
45+
try
46+
{
47+
await AuthAPIRequests.SendCodeToEmail(email, userSession.Id);
48+
}
49+
catch (Exception e)
50+
{
51+
OnSignInError?.Invoke(e.Message);
52+
}
4653
}
4754

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

6471
public static async void Signup(string email)
6572
{
66-
await AuthAPIRequests.Signup(email, userSession.Id);
73+
try
74+
{
75+
await AuthAPIRequests.Signup(email, userSession.Id);
76+
}
77+
catch (Exception e)
78+
{
79+
OnSignInError?.Invoke(e.Message);
80+
}
6781
}
6882

6983
public static async Task RefreshToken()

0 commit comments

Comments
 (0)