diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-04-16 10:29:20 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-04-16 10:29:20 -0400 |
commit | d041ee1cc39c9022db6f123489bea820f8dfed4b (patch) | |
tree | 63b2f37519fc77017aecf44772685181b9f216f1 | |
parent | b8c2989526d8a6b1bf741ca3827788e76139d10b (diff) | |
download | sdl_ios-d041ee1cc39c9022db6f123489bea820f8dfed4b.tar.gz |
Add an "encryption unknown error
-rw-r--r-- | SmartDeviceLink/private/SDLError.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLError.m | 12 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLProtocol.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/public/SDLErrorConstants.h | 5 |
4 files changed, 19 insertions, 1 deletions
diff --git a/SmartDeviceLink/private/SDLError.h b/SmartDeviceLink/private/SDLError.h index 1621d8f1b..f6e7a0bb9 100644 --- a/SmartDeviceLink/private/SDLError.h +++ b/SmartDeviceLink/private/SDLError.h @@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN + (NSError *)sdl_encryption_lifecycle_notReadyError; + (NSError *)sdl_encryption_lifecycle_encryption_off; + (NSError *)sdl_encryption_lifecycle_nak; ++ (NSError *)sdl_encryption_unknown; #pragma mark SDLManager diff --git a/SmartDeviceLink/private/SDLError.m b/SmartDeviceLink/private/SDLError.m index 35818d361..5ee60e6bb 100644 --- a/SmartDeviceLink/private/SDLError.m +++ b/SmartDeviceLink/private/SDLError.m @@ -52,6 +52,18 @@ NS_ASSUME_NONNULL_BEGIN } ++ (NSError *)sdl_encryption_unknown { + NSDictionary<NSString *, NSString *> *userInfo = @{ + NSLocalizedDescriptionKey: @"Encryption received an unknown error", + NSLocalizedFailureReasonErrorKey: @"We don't know the reason for the failure", + NSLocalizedRecoverySuggestionErrorKey: @"Ensure that encryption is properly set up" + }; + + return [NSError errorWithDomain:SDLErrorDomainEncryptionLifecycleManager + code:SDLEncryptionLifecycleManagerErrorNAK + userInfo:userInfo]; +} + #pragma mark - SDLManager + (NSError *)sdl_lifecycle_rpcErrorWithDescription:(nullable NSString *)description andReason:(nullable NSString *)reason { diff --git a/SmartDeviceLink/private/SDLProtocol.m b/SmartDeviceLink/private/SDLProtocol.m index 5e8ad60f4..13b628bf7 100644 --- a/SmartDeviceLink/private/SDLProtocol.m +++ b/SmartDeviceLink/private/SDLProtocol.m @@ -351,6 +351,8 @@ NS_ASSUME_NONNULL_BEGIN if (!messagePayload) { if (encryptError != nil) { *error = encryptError; + } else { + *error = [NSError sdl_encryption_unknown]; } return NO; } diff --git a/SmartDeviceLink/public/SDLErrorConstants.h b/SmartDeviceLink/public/SDLErrorConstants.h index da4757ec1..e653ad2d4 100644 --- a/SmartDeviceLink/public/SDLErrorConstants.h +++ b/SmartDeviceLink/public/SDLErrorConstants.h @@ -73,7 +73,10 @@ typedef NS_ENUM(NSInteger, SDLEncryptionLifecycleManagerError) { /** * Received NAK from the remote head unit. */ - SDLEncryptionLifecycleManagerErrorNAK = -3 + SDLEncryptionLifecycleManagerErrorNAK = -3, + + /// An unknown error occurred + SDLEncryptionLifecycleManagerErrorUnknown = -4 }; /** |