question

rickybeechingdev avatar image
rickybeechingdev asked

Would like help getting errors to display correctly in my app.

Hey all, I want to preface this by saying I am sorry if this is a stupid question, I am very new to all of this.

The issue I am facing is that I can't seem to display certain sign-up errors quite correctly in my app. Some of the errors display as expected. For example if I try to sign-up using an email that I have already made an account with in my app, it will give me "Error: Email address is not available" which is great. The same works if I try to sign-up using an already taken username.

The problem arises when the error is to do with input requirements, such as password / username being too short, or the email having incorrect characters in. The error just simply shows as "Error: Invalid input parameters" and nothing more. Doesn't give any info about what field or anything so the user will get confused as to what's wrong.

Here's an example of this issue with an incorrectly formatted email:

6243-image.png

And here's an example when the email is correct but the username isnt:

6244-image.png

They're the same error.

Is there any way I can get more info about these errors in particular?

I am getting the error info in an OnError callback in PlayFabClientAPI.RegisterPlayFabUser, and here is the code for the callback:

 private void OnError(PlayFabError error)
     {  
         // Show error panel and update error text
         errorPanelHolder.style.display = DisplayStyle.Flex;
         errorTxt.text = "Error: " + error.ErrorMessage;
     }
unity3dAuthentication
image.png (21.2 KiB)
10 |1200

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

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

You can get the error details message in the “ErrorDetails” filed. Here is the code example:

 private void OnError(PlayFabError error)
     {
         Debug.Log(error.ErrorMessage);
         if (error.ErrorDetails!=null)
         {
             foreach (var errorDetail in error.ErrorDetails)
             {
                 foreach (var erorDetailvalue in errorDetail.Value)
                 {
                     Debug.Log(errorDetail.Key + ": " + erorDetailvalue);
                 }
             }
         }           
     }
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.