private void OnError(Xsolla.Core.Error error) { switch (error.ErrorType) { case ErrorType.UsernameIsTaken: OpenPopUp("Username Is Taken.", PopUpWindows.Error); break; case ErrorType.EmailIsTaken: OpenPopUp("Email Is Taken", PopUpWindows.Error); break; case ErrorType.InvalidLoginOrPassword: OpenPopUp("Wrong username or password", PopUpWindows.Error); break; case ErrorType.InvalidToken: OpenPopUp("Invalid Token", PopUpWindows.Error); break; case ErrorType.NetworkError: OpenPopUp(string.Format("Network Error: {0}", error.errorMessage), PopUpWindows.Error); break; default: string errorMessage = !string.IsNullOrEmpty(error.errorMessage) ? error.errorMessage : !string.IsNullOrEmpty(error.errorCode) ? error.errorCode : !string.IsNullOrEmpty(error.statusCode) ? error.statusCode : "Unknown error"; OpenPopUp(errorMessage, PopUpWindows.Error); break; } }
public void ShowError(Xsolla.Core.Error error) { print(error); PreparePopUp()?.ShowError(error, () => { _popup = null; }); }