Show merge conflict file names in the error message (#681)

This commit is contained in:
Mingshen Sun 2025-02-16 13:01:42 -08:00 committed by GitHub
parent 1d6785511a
commit fddd0c2563
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -528,11 +528,10 @@ extension PasswordNavigationViewController: PasswordAlertPresenter {
SVProgressHUD.showSuccess(withStatus: "Done".localize()) SVProgressHUD.showSuccess(withStatus: "Done".localize())
SVProgressHUD.dismiss(withDelay: 1) SVProgressHUD.dismiss(withDelay: 1)
} }
} catch { } catch let error as NSError {
gitCredential.delete() gitCredential.delete()
DispatchQueue.main.async { DispatchQueue.main.async {
SVProgressHUD.dismiss() SVProgressHUD.dismiss()
let error = error as NSError
var message = error.localizedDescription var message = error.localizedDescription
if let underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError { if let underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError {
message = message | "UnderlyingError".localize(underlyingError.localizedDescription) message = message | "UnderlyingError".localize(underlyingError.localizedDescription)
@ -540,6 +539,10 @@ extension PasswordNavigationViewController: PasswordAlertPresenter {
message = message | "RecoverySuggestion.".localize() message = message | "RecoverySuggestion.".localize()
} }
} }
if let mergeConflictFiles = error.userInfo[GTPullMergeConflictedFiles] as? NSArray {
let mergeConflictFilesString = mergeConflictFiles.componentsJoined(by: ", ")
message = message | "MergeConflictError".localize(mergeConflictFilesString)
}
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(800)) { DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(800)) {
Utils.alert(title: "Error".localize(), message: message, controller: self, completion: nil) Utils.alert(title: "Error".localize(), message: message, controller: self, completion: nil)
} }

View file

@ -34,6 +34,7 @@
"UnresolvedError" = "Unresolved error %@"; "UnresolvedError" = "Unresolved error %@";
"MigrationError" = "Migration error: %@"; "MigrationError" = "Migration error: %@";
"UnderlyingError" = "Underlying Error: %@"; "UnderlyingError" = "Underlying Error: %@";
"MergeConflictError" = "Conflict files: %@";
"ErrorSaving" = "Error saving: %@"; "ErrorSaving" = "Error saving: %@";
"CannotCopyPassword" = "Cannot copy password"; "CannotCopyPassword" = "Cannot copy password";
"CannotAddPassword" = "Cannot add password"; "CannotAddPassword" = "Cannot add password";