[AltServer] Improves ALTServerErrorIncompatibleDeveloperDisk error message

Uses NSError’s debug description, if available, to populate error alerts.
This commit is contained in:
Riley Testut
2022-03-01 16:07:20 -08:00
parent 37b00d670b
commit ebb236e47c
4 changed files with 48 additions and 2 deletions

View File

@@ -319,7 +319,12 @@ private extension AppDelegate
if let errorFailure = nsError.localizedFailure
{
if let failureReason = nsError.localizedFailureReason
if let debugDescription = nsError.localizedDebugDescription
{
alert.messageText = errorFailure
messageComponents.append(debugDescription)
}
else if let failureReason = nsError.localizedFailureReason
{
if nsError.localizedDescription.starts(with: errorFailure)
{
@@ -352,7 +357,15 @@ private extension AppDelegate
else
{
alert.messageText = localizedFailure
messageComponents.append(nsError.localizedDescription)
if let debugDescription = nsError.localizedDebugDescription
{
messageComponents.append(debugDescription)
}
else
{
messageComponents.append(nsError.localizedDescription)
}
}
if let recoverySuggestion = nsError.localizedRecoverySuggestion

View File

@@ -1219,6 +1219,7 @@ NSNotificationName const ALTDeviceManagerDeviceDidDisconnectNotification = @"ALT
// Connection failed with .unknown error code, so we assume the developer disk is NOT compatible.
NSMutableDictionary *userInfo = [@{
ALTOperatingSystemVersionErrorKey: NSStringFromOperatingSystemVersion(altDevice.osVersion),
NSFilePathErrorKey: diskURL.path,
NSUnderlyingErrorKey: error,
} mutableCopy];