From 8d8d8fdd61d66841190660ae824a9bd7abeea129 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 12 Dec 2022 15:40:20 -0600 Subject: [PATCH] [Shared] Uses underlying error messages (if available) for ALTServerError.invalidRequest/.invalidResponse --- Shared/Categories/NSError+ALTServerError.m | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Shared/Categories/NSError+ALTServerError.m b/Shared/Categories/NSError+ALTServerError.m index a96c4bdd..d107eaab 100644 --- a/Shared/Categories/NSError+ALTServerError.m +++ b/Shared/Categories/NSError+ALTServerError.m @@ -81,6 +81,16 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste return underlyingError.localizedDescription; } + case ALTServerErrorInvalidRequest: + case ALTServerErrorInvalidResponse: + { + NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; + if (underlyingError != nil) + { + return underlyingError.localizedDescription; + } + } + default: return nil; } @@ -169,10 +179,26 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste return NSLocalizedString(@"AltServer could not write data to this device.", @""); case ALTServerErrorInvalidRequest: + { + NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; + if (underlyingError.localizedFailureReason != nil) + { + return underlyingError.localizedFailureReason; + } + return NSLocalizedString(@"AltServer received an invalid request.", @""); + } case ALTServerErrorInvalidResponse: + { + NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; + if (underlyingError.localizedFailureReason != nil) + { + return underlyingError.localizedFailureReason; + } + return NSLocalizedString(@"AltServer sent an invalid response.", @""); + } case ALTServerErrorInvalidApp: return NSLocalizedString(@"The app is in an invalid format.", @""); @@ -291,6 +317,8 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste switch ((ALTServerError)self.code) { case ALTServerErrorUnderlyingError: + case ALTServerErrorInvalidRequest: + case ALTServerErrorInvalidResponse: { NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; return underlyingError.alt_localizedDebugDescription;