+ More detailed reason for brew backup dumping failure

This commit is contained in:
David Bureš 2024-05-24 13:08:17 +02:00
parent baa56a82fe
commit ff59cf60b3
5 changed files with 65 additions and 7 deletions

View File

@ -541,10 +541,10 @@ struct ContentView: View, Sendable
appState.dismissAlert()
})
)
case .couldNotDumpBrewfile:
case .couldNotDumpBrewfile(let error):
return Alert(
title: Text("alert.could-not-dump-brewfile.title"),
message: Text("message.try-again-or-restart"),
message: Text("message.try-again-or-restart-\(error)"),
dismissButton: .default(Text("action.close"), action: {
appState.dismissAlert()
})

View File

@ -483,8 +483,8 @@ struct CorkApp: App
case .couldNotDetermineWorkingDirectory:
appDelegate.appState.showAlert(errorToShow: .couldNotGetWorkingDirectory)
case .errorWhileDumpingBrewfile:
appDelegate.appState.showAlert(errorToShow: .couldNotDumpBrewfile)
case .errorWhileDumpingBrewfile(let error):
appDelegate.appState.showAlert(errorToShow: .couldNotDumpBrewfile(error: error))
case .couldNotReadBrewfile:
appDelegate.appState.showAlert(errorToShow: .couldNotReadBrewfile)

View File

@ -24,6 +24,6 @@ enum FatalAlertType
case couldNotSynchronizePackages
//MARK: - Brewfile exporting/importing
case couldNotGetWorkingDirectory, couldNotDumpBrewfile, couldNotReadBrewfile
case couldNotGetWorkingDirectory, couldNotDumpBrewfile(error: String), couldNotReadBrewfile
case couldNotGetBrewfileLocation, couldNotImportBrewfile, malformedBrewfile
}

View File

@ -14854,6 +14854,64 @@
}
}
},
"message.try-again-or-restart-%@" : {
"localizations" : {
"cs" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\nZkuste to znovu nebo restartujte Cork"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\nVersuche es erneut, oder starte Cork neu"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\nTry again, or restart Cork"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\nRéessayez ou redémarrez Cork"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\n다시 시도하거나 Cork를 다시 시작하세요."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\nПопробуйте еще раз, либо перезапустите Cork"
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\nСпробуйте ще раз або перезапустіть Cork"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\n请重试或重启 Cork"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "%@\n請重試或重啟 Cork"
}
}
}
},
"navigation.about" : {
"comment" : "MARK: - Navigation",
"localizations" : {

View File

@ -9,7 +9,7 @@ import Foundation
enum BrewfileDumpingError: Error
{
case couldNotDetermineWorkingDirectory, errorWhileDumpingBrewfile, couldNotReadBrewfile
case couldNotDetermineWorkingDirectory, errorWhileDumpingBrewfile(error: String), couldNotReadBrewfile
}
/// Exports the Brewfile and returns the contents of the Brewfile itself for further manipulation. Does not preserve the Brewfile
@ -44,7 +44,7 @@ func exportBrewfile(appState: AppState) async throws -> String
if await !brewfileDumpingResult.standardError.isEmpty
{
throw BrewfileDumpingError.errorWhileDumpingBrewfile
throw await BrewfileDumpingError.errorWhileDumpingBrewfile(error: brewfileDumpingResult.standardError)
}
AppConstants.logger.info("Path: \(workingDirectory, privacy: .auto)")