Skip to content

Commit a58f93f

Browse files
committed
Update noActiveBackup error display logic
1 parent 60602b0 commit a58f93f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

TangemSdk/TangemSdk/Common/Core/TangemSdkError.swift

+11-4
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,8 @@ public enum TangemSdkError: Error, LocalizedError, Encodable {
515515
return "error_backup_wrong_card".localized("\(self.code)")
516516
case .backupFailedAlreadyCreated:
517517
return "error_backup_failed_already_created".localized
518-
case .noActiveBackup:
519-
return "error_no_active_backup".localized
520-
case .resetPinWrongCard:
521-
return "error_reset_wrong_card".localized("\(self.code)")
518+
case .resetPinWrongCard(let internalCode):
519+
return localizedMessageForResetPinWrongCard(code: internalCode)
522520
case .oldCard: return "error_old_card".localized
523521
case .userCodeRecoveryDisabled: return "error_user_code_recovery_disabled".localized
524522

@@ -532,6 +530,15 @@ public enum TangemSdkError: Error, LocalizedError, Encodable {
532530
}
533531
}
534532

533+
private func localizedMessageForResetPinWrongCard(code: Int?) -> String {
534+
switch code {
535+
case TangemSdkError.noActiveBackup.code:
536+
return "error_no_active_backup".localized
537+
default:
538+
return "error_reset_wrong_card".localized("\(self.code)")
539+
}
540+
}
541+
535542
public var jsonDescription: String {
536543
let encoder = JSONEncoder()
537544
encoder.outputFormatting = [.sortedKeys, .prettyPrinted]

0 commit comments

Comments
 (0)