question

katiepearce avatar image
katiepearce asked

PlayFabError not being called when logging in offline.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

This behavior -- OnPlayFabError does not be called when the device is offline, is the expected behavior. PlayFabError is defined for catching the error returned from PlayFab API. If the client device is offline, Http requests will not be sent successfully, so no errors would be returned. If you want a method to check if the current device is offline, you can consider using Unity native methods, such as Application.internetReachability.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

katiepearce avatar image
katiepearce answered

I'm attempting to create error handling for when the user logs in without being online. I am getting two errors in the unity log when I do this, one related to JSON and another SharedErrorCallback.

This is fine in my opinion but more to my problem is that it's not actually triggering the PlayFabError. In fact, it seems to be happening when the scene loads before I even try logging in.

This is an old thread but I'm having the same issue. I'm deliberately trying to log in when not connected to the internet so I can handle that failure.


This error is preventing me from receiving the event from a failed login. I don't seem to have any way of detecting and responding to these.

Two Errors;
EditorExtensions: Caught an error:Invalid JSON string UnityEngine.Debug:LogError(Object) PlayFab.PfEditor.PlayFabEditor:StateUpdateHandler(EdExStates, String, String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/PlayFabEditor.cs:332) PlayFab.PfEditor.PlayFabEditor:RaiseStateUpdate(EdExStates, String, String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/PlayFabEditor.cs:247) PlayFab.PfEditor.PlayFabEditorHelper:SharedErrorCallback(PlayFabError) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/Utils/PlayFabEditorHelper.cs:128) PlayFab.PfEditor.PlayFabEditorHttp:OnWwwError(Action`1, String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/PlayFabEditorSDK/PlayFabEditorHttp.cs:130) PlayFab.PfEditor.<>c__DisplayClass2_0`2:<MakeApiCall>b__1(String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/PlayFabEditorSDK/PlayFabEditorHttp.cs:95) PlayFab.PfEditor.<Post>d__7:MoveNext() (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/PlayFabEditorSDK/PlayFabEditorHttp.cs:177) PlayFab.PfEditor.EditorCoroutine:Update() (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/Utils/EditorCoroutine.cs:103) UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

PlayFab EditorExtensions: Caught an error:SharedErrorCallbackCannot resolve destination host UnityEngine.Debug:LogError(Object) PlayFab.PfEditor.PlayFabEditor:StateUpdateHandler(EdExStates, String, String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/PlayFabEditor.cs:332) PlayFab.PfEditor.PlayFabEditor:RaiseStateUpdate(EdExStates, String, String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/PlayFabEditor.cs:247) PlayFab.PfEditor.PlayFabEditorHelper:SharedErrorCallback(String) (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/Utils/PlayFabEditorHelper.cs:133) PlayFab.PfEditor.<Post>d__7:MoveNext() (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/PlayFabEditorSDK/PlayFabEditorHttp.cs:177) PlayFab.PfEditor.EditorCoroutine:Update() (at Assets/Plugins/ShivaCode/Editor/PlayFabEditorExtensions/Editor/Scripts/Utils/EditorCoroutine.cs:103) UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

katiepearce avatar image
katiepearce answered

Okay, problem with not receiving the error event was a problem with a boolean not being reset and therefore I was never actually trying to log in. Those two errors happen even without trying to log in, but only when offline.

So I'm not sure why they are happening at all. For my purposes I'm not worried about them. We expect the user to be online.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.