From e96a5114e5cd1ef26e180125c53f335c38dd1770 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 | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Shared/Categories/NSError+ALTServerError.m b/Shared/Categories/NSError+ALTServerError.m index c2d1594c..911a0973 100644 --- a/Shared/Categories/NSError+ALTServerError.m +++ b/Shared/Categories/NSError+ALTServerError.m @@ -81,6 +81,17 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; return underlyingError.localizedDescription; } + + case ALTServerErrorInvalidRequest: + case ALTServerErrorInvalidResponse: + { + NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; + if (underlyingError != nil) + { + return underlyingError.localizedDescription; + } + } + default: return nil; } @@ -167,10 +178,26 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste return NSLocalizedString(@"SideStore could not write data to this device.", @""); case ALTServerErrorInvalidRequest: + { + NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; + if (underlyingError.localizedFailureReason != nil) + { + return underlyingError.localizedFailureReason; + } + return NSLocalizedString(@"SideStore received an invalid request.", @""); + } case ALTServerErrorInvalidResponse: + { + NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; + if (underlyingError.localizedFailureReason != nil) + { + return underlyingError.localizedFailureReason; + } + return NSLocalizedString(@"SideStore sent an invalid response.", @""); + } case ALTServerErrorInvalidApp: return NSLocalizedString(@"The app is in an invalid format.", @""); @@ -282,6 +309,8 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste switch ((ALTServerError)self.code) { case ALTServerErrorUnderlyingError: + case ALTServerErrorInvalidRequest: + case ALTServerErrorInvalidResponse: { NSError *underlyingError = self.userInfo[NSUnderlyingErrorKey]; return underlyingError.alt_localizedDebugDescription;