fromJsonMap static method

FireblocksError? fromJsonMap(
  1. Map<String, dynamic>? data
)

Implementation

static FireblocksError? fromJsonMap(Map<String, dynamic>? data) {
  if (data == null) {
    return null;
  }
  int errorCode = data['errorCode'];
  // create a switch case for each error type
  switch (errorCode) {
    case 102:
      return InvalidCertificate();
    case 106:
      return MissingAlgorithms();
    case 107:
      return MissingPrivateKeys();
    case 200:
      return NoFirstMessageTimeout();
    case 201:
      return UnknownAlgorithm();
    case 202:
      return MissingKeyOnDevice();
    case 203:
      return KeyCreationTimeout();
    case 204:
      return FailedToSendPublicKey();
    case 205:
      return FailedToRequestKey();
    case 206:
      return FailedToEnrollPlayer();
    case 207:
      return FailedToCreateKey();
    case 300:
      return FailedToRequestEndUserTakeover();
    case 301:
      return FailedToTakeoverKeys();
    case 302:
      return KeyTakeoverTimeout();
    case 400:
      return FailedToExportKeys();
    case 401:
      return MissingPublicKeys();
    case 402:
      return MissingPublicKey();
    case 403:
      return FailedToDeriveAssetKey();
    case 404:
      return MissingCloudPrivateKeys();
    case 405:
      return MissingChainCode();
    case 406:
      return MissingPrivateKey();
    case 407:
      return PublicKeysDiscrepancyError();
    case 408:
      return FailedToExportKey();
    case 500:
      return UnknownTxId();
    case 501:
      return NoFirstTxSigningMessage();
    case 502:
      return FailedToSignTransaction();
    case 503:
      return TransactionSigningTimeout();
    case 504:
      return TransactionSigningStopped();
    case 600:
      return BackupNotAvailableError();
    case 601:
      return FailedToRecoverKeys();
    case 700:
      return FailedToGetKeyIds();
    case 701:
      return MissingKeyIdsForBackup();
    case 702:
      return KeysDiscrepancyBackupError();
    case 703:
      return MissingKeysBackupError();
    case 704:
      return FailedToBackupKey();
    case 705:
      return InvalidPassphraseError();
    case 800:
      return InvalidAddDeviceSetupData();
    case 900:
      return FailedToJoinWallet();
    case 901:
      return JoinWalletTimeout();
    case 902:
      return JoinWalletStopped();
    case 1000:
      return FailedToApproveJoinWallet();
    case 1001:
      return ApproveJoinWalletTimeout();
    case 1002:
      return NoKeysToProvision();
    case 1003:
      return ApproveJoinWalletStopped();
    default:
      return null;
  }
}