diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2017-03-07 12:11:31 -0800 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2017-03-07 12:11:31 -0800 |
commit | f66d517be4bad0c0bd3d73e64c8a98f7acd50180 (patch) | |
tree | c99cd41c281208b3ea8cc090bc64ad96b8c39c9a | |
parent | ab605bfa3c1349fad004460d532ecd207a0066d6 (diff) | |
download | sdl_ios-f66d517be4bad0c0bd3d73e64c8a98f7acd50180.tar.gz |
Added additional error code for registration successful, but with a warning.feature/issue_511_register_warning_error_code
-rw-r--r-- | SmartDeviceLink/SDLError.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLError.m | 10 | ||||
-rw-r--r-- | SmartDeviceLink/SDLErrorConstants.h | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLError.h b/SmartDeviceLink/SDLError.h index 71472f30a..09ec20ee8 100644 --- a/SmartDeviceLink/SDLError.h +++ b/SmartDeviceLink/SDLError.h @@ -30,6 +30,7 @@ extern SDLErrorDomain *const SDLErrorDomainFileManager; + (NSError *)sdl_lifecycle_unknownRemoteErrorWithDescription:(NSString *)description andReason:(NSString *)reason; + (NSError *)sdl_lifecycle_managersFailedToStart; + (NSError *)sdl_lifecycle_startedWithBadResult:(SDLResult)result info:(NSString *)info; ++ (NSError *)sdl_lifecycle_startedWithWarning:(SDLResult)result info:(NSString *)info; + (NSError *)sdl_lifecycle_failedWithBadResult:(SDLResult)result info:(NSString *)info; #pragma mark SDLFileManager diff --git a/SmartDeviceLink/SDLError.m b/SmartDeviceLink/SDLError.m index 5afad3fac..511f91deb 100644 --- a/SmartDeviceLink/SDLError.m +++ b/SmartDeviceLink/SDLError.m @@ -81,6 +81,16 @@ SDLErrorDomain *const SDLErrorDomainFileManager = @"com.sdl.filemanager.error"; userInfo:userInfo]; } ++ (NSError *)sdl_lifecycle_startedWithWarning:(SDLResult)result info:(NSString *)info { + NSDictionary<NSString *, NSString *> *userInfo = @{ + NSLocalizedDescriptionKey: NSLocalizedString(result, nil), + NSLocalizedFailureReasonErrorKey: NSLocalizedString(info, nil) + }; + return [NSError errorWithDomain:SDLErrorDomainLifecycleManager + code:SDLManagerErrorRegistrationSuccessWithWarning + userInfo:userInfo]; +} + + (NSError *)sdl_lifecycle_failedWithBadResult:(SDLResult)result info:(NSString *)info { NSDictionary<NSString *, NSString *> *userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(result, nil), diff --git a/SmartDeviceLink/SDLErrorConstants.h b/SmartDeviceLink/SDLErrorConstants.h index 24d1d58f7..c439d3fd6 100644 --- a/SmartDeviceLink/SDLErrorConstants.h +++ b/SmartDeviceLink/SDLErrorConstants.h @@ -36,6 +36,10 @@ typedef NS_ENUM(NSInteger, SDLManagerError) { * Registering with the remote system failed. */ SDLManagerErrorRegistrationFailed = -6, + /** + * Registering with the remote system was successful, but had a warning. + */ + SDLManagerErrorRegistrationSuccessWithWarning = -7 }; /** diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index dba15fbdd..74bcf4064 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -282,7 +282,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; // If the resultCode isn't success, we got a warning. Errors were handled in `didEnterStateConnected`. if (![registerResult isEqualToString:SDLResultSuccess]) { - startError = [NSError sdl_lifecycle_startedWithBadResult:registerResult info:registerInfo]; + startError = [NSError sdl_lifecycle_startedWithWarning:registerResult info:registerInfo]; } // If we got to this point, we succeeded, send the error if there was a warning. |