question

MoonHeonYoung avatar image
MoonHeonYoung asked

proper error handling

I have read "error handling best practices", but I don't understand well/

Can the PlayFab Manager notice that the user has failed the call?

In Unity, For some reason (weak wifi signal, disconnection of internet, etc.),

is there a way to detect this in PlayFab playstream orEventHistory when a user fails to call api from client and goes to error=> call??

There are many playfab calls in my game, but there is no processing except debug.log in the error part of each playfab call.

If the user consumes VC and another internal call fails (the VC are consumed but the item cannot be acquired), a big problem is likely to occur.

When an error occurs, should I write a code that writes WriteEvent in error Callback?? Or do I have to call the function again after a few seconds?

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

·
Seth Du avatar image
Seth Du answered

If the error is caused on PlayFab side, for example, players doesn’t have enough VC to buy an item, it will generate a PlayStream Event as the record. Meanwhile, the network errors should be handled on the clients. Basically there are 2 possible situations.

The request isn’t sent successfully due to network issue. In this scenario, nothing will happen on players’ data, the client should capture the errors and ask the player to re-interact with the UI or cache the data locally and set up a task queue to wait for a reliable connection. During this time, I don’t suggest letting players to continue to play the game (it depends on the genre of your game).

Another scenario is request has been sent successfully, the client has issue when receiving the response. This will be simple because it only requires the clients to have a data refreshing when the connection becomes reliable.

>>If the user consumes VC and another internal call fails

If using PurchaseItem API, when the API is failed, the transaction simply won’t happen, no data or item is changed. The player need to purchase again. If you have customized purchase process and use Cloud Script to handle. We suggest grant the item first, before the VC is subtracted.(which can reduce the complaints) Though the failed possibility is low, RESTful API cannot guarantee 100% reliability.

>>When an error occurs, should I write a code that writes WriteEvent in error Callback?

I cannot say it is unnecessary, but if it is required, you may use the method I have mentioned above, and use a locally cached task queue to call WriteEvent to log Internet issues when the connection is back.

In a word, network issues shouldn’t be a major issue because RESTful API is stateless. Simply re-send will handle most of the cases. If you have a specific scenario that requires a reliable process, feel free to tell us so that we can dig into it.

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.