getUserFriendlyMsg function

String getUserFriendlyMsg(
  1. int code
)

Retrieves a user-friendly error message based on an error code.

This function takes an error code as input and returns a user-friendly error message associated with that code. It uses a switch-case structure to map error codes to corresponding messages. If the provided code does not match any known error code, a default error message is returned.

@param code The error code for which to retrieve a user-friendly message. @return A user-friendly error message corresponding to the provided error code.

Implementation

String getUserFriendlyMsg(int code) {
  switch (code) {
    case 0:
      return slowInternet;
    case 4:
      return userWithThatPhoneExists;
    case 5:
      return userWithThatEmailExists;
    case 6:
      return usernameExists;
    case 7:
    case 10:
      return userNotFound;
    case 8:
      return wrongLoginCredentials;
    case 9:
      return pinNotFound;
    case 48:
      return pinExpired;
    case 72:
      return pendingPINResetRequest;
    case 73:
      return tooManyAttemptsString;

    default:
      return defaultUserFriendlyMessage;
  }
}