Skip to content

Commit fddd0c2

Browse files
authored
Show merge conflict file names in the error message (#681)
1 parent 1d67855 commit fddd0c2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pass/Controllers/PasswordNavigationViewController.swift

+5-2
Original file line numberDiff line numberDiff line change
@@ -528,18 +528,21 @@ extension PasswordNavigationViewController: PasswordAlertPresenter {
528528
SVProgressHUD.showSuccess(withStatus: "Done".localize())
529529
SVProgressHUD.dismiss(withDelay: 1)
530530
}
531-
} catch {
531+
} catch let error as NSError {
532532
gitCredential.delete()
533533
DispatchQueue.main.async {
534534
SVProgressHUD.dismiss()
535-
let error = error as NSError
536535
var message = error.localizedDescription
537536
if let underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError {
538537
message = message | "UnderlyingError".localize(underlyingError.localizedDescription)
539538
if underlyingError.localizedDescription.contains("WrongPassphrase".localize()) {
540539
message = message | "RecoverySuggestion.".localize()
541540
}
542541
}
542+
if let mergeConflictFiles = error.userInfo[GTPullMergeConflictedFiles] as? NSArray {
543+
let mergeConflictFilesString = mergeConflictFiles.componentsJoined(by: ", ")
544+
message = message | "MergeConflictError".localize(mergeConflictFilesString)
545+
}
543546
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(800)) {
544547
Utils.alert(title: "Error".localize(), message: message, controller: self, completion: nil)
545548
}

pass/en.lproj/Localizable.strings

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"UnresolvedError" = "Unresolved error %@";
3535
"MigrationError" = "Migration error: %@";
3636
"UnderlyingError" = "Underlying Error: %@";
37+
"MergeConflictError" = "Conflict files: %@";
3738
"ErrorSaving" = "Error saving: %@";
3839
"CannotCopyPassword" = "Cannot copy password";
3940
"CannotAddPassword" = "Cannot add password";

0 commit comments

Comments
 (0)