Errors not catchable

I am on the task to handling the potential lose of internet connection at different points in my app.
So starting with auth. I struggle to properly catch the errors. Errors pause the editor.

 try
                    {
                       await AuthenticationService.Instance.SignInAnonymouslyAsync();
                    }
                    catch (AuthenticationException ex)
                    {
                        Debug.LogException(ex);
                    }
                    catch (RequestFailedException ex)
                    {
                        Debug.LogException(ex);

                }

I also did it in a seperate function returning a task as mentioned here:
https://docs.unity.com/authentication/UsingAnonSignIn.html

Still the errors are not catched!
The only time I get the error message printed myself is through an event subscription

AuthenticationService.Instance.SignInFailed += OnFailedSignIn;

8286342--1086081--upload_2022-7-17_15-0-31.png

Nevermind I just realized we are logging as Exception. After changing both to Debug.Log(
ex);

Only one error remains, but still editor stopping.

[Authentication]: Request failed: 0, Cannot resolve destination host

Its that one coming from the Service api:
8286495--1086093--upload_2022-7-17_16-6-20.png

Is there another way of solving that so we dont have the editor paused?


Do you have Error Pause on for the Console window in the Unity Editor?

Hi @JeffDUnity3D ,
yes your right I did not know I can turn this off, thanks!

But still shouldnt I be able to catch all errors?
I dont like seeing red stuff in the console. Would be nice if the try catch just prevents that message.
8303814--1089243--upload_2022-7-22_23-56-4.png

Maybe its just a nice to have..

We will look to remove unwanted error logs, we agree they should not be forced on you if you are handling the exceptions

1 Like