Every request send to fireball can return an ErrorResponse
message. There are main errors types:
authenticate-reject
, bet-place-rejected
, jackpot-pay-rejected
e.t.c - means not allowed actions for integration side due to different reason (wrong provided parameters, IDs, not enough money on balance, operator integration internal errors e.t.c)if (errorResponse.IsTimeout)
{
// handle timeout
Debug.LogError($"Error: Timeout - {errorResponse.Reason}");
}
else
{
// handle error by name
Debug.LogError($"Error: {errorResponse.Name} - {errorResponse.Reason}");
}
Some errors can contain updated Balance
for different situation when manipulation with Players balance are failed:
if (errorResponse.Balance != null)
{
// update game balance
_game.UpdateBalance(errorResponse.Balance.Value);
}
Some errors may contain the ErrorDialog
object with additional details about the error dialogue for the game client.
if (errorResponse.HasDialog)
{
// show error dialogue
ShowErrorDialogue(errorResponse.Error.Dialog);
}
public Text _dialogTitle;
public Text _dialogMessage;
public void ShowErrorDialogue(ErrorDialog dialog)
{
// set error data into dialogue
_dialogTitle.text = dialog.Title;
_dialog.text = dialog.Message;
// set dialogue buttons
SetErrorButtons(dialog.Buttons);
}
errorButton.Action
field in ErrorDialogButton
listOK
- click on button means just close error dialogue and allows player to continue playReload
- click on button means quit and reload (restart) the game fullyRetry
- click on button means send same request againRedirect
- click on button means quit the game and go to the webpageClientScript
- means send GCI operator error event to the operator page (more)Home
- means quit the game and go to the home pagepublic BaseRequest _lastRequest;
public RectTransform _dialogue;
public List<Button> _dailogButton;
public void SetErrorButtons(List<ErrorDialogButton> buttons)
{
for (int i = 0; i < buttons.Count; i++)
{
_dailogButton[i].GetComponentInChildren<Text>().text = buttons[i].Text;
switch (buttons[i].Action)
{
case DialogButtonAction.OK:
_dailogButton[i].onClick.AddListener(() =>
{
// close dialogue
_dialogue.gameObject.SetActive(false);
});
break;
case DialogButtonAction.Reload:
_dailogButton[i].onClick.AddListener(() =>
{
// reload game
WebBrowser.ReloadPage();
});
break;
case DialogButtonAction.Retry:
_dailogButton[i].onClick.AddListener(() =>
{
// resend same request
_fireball.ResendLastRequest();
});
break;
case DialogButtonAction.Redirect:
_dailogButton[i].onClick.AddListener(() =>
{
// open provided link
WebBrowser.SetLocation(buttons[i].Link);
});
break;
case DialogButtonAction.ClientScript:
_dailogButton[i].onClick.AddListener(() =>
{
// send integration error to the operators page
_fireball.GameClientInterface.SendIntegrationError(buttons[i].ClientScript.Value);
});
break;
case DialogButtonAction.Home:
_dailogButton[i].onClick.AddListener(() =>
{
// go home page if it provided
_fireball.GoHomePage();
});
break;
}
}
}