summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-01-24 10:18:18 -0800
committerMuller, Alexander (A.) <amulle19@ford.com>2017-01-24 10:18:18 -0800
commitd19adbc482610889ee817199135813a50496187f (patch)
treeaec2bf045d0eb0d60e29b4e7a4ce3eddf18074cf
parentd61560c8e1c2edeadb81ea8bc33d7e232ea78369 (diff)
downloadsdl_ios-d19adbc482610889ee817199135813a50496187f.tar.gz
Updated SDLManagerError enum to include a warning case.hotfix/issue_505_rai_response_handler
-rw-r--r--SmartDeviceLink/SDLError.h1
-rw-r--r--SmartDeviceLink/SDLError.m10
-rw-r--r--SmartDeviceLink/SDLErrorConstants.h4
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m2
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m2
5 files changed, 17 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLError.h b/SmartDeviceLink/SDLError.h
index 7572adc9a..535769d07 100644
--- a/SmartDeviceLink/SDLError.h
+++ b/SmartDeviceLink/SDLError.h
@@ -31,6 +31,7 @@ extern SDLErrorDomain *const SDLErrorDomainFileManager;
+ (NSError *)sdl_lifecycle_managersFailedToStart;
+ (NSError *)sdl_lifecycle_startedWithBadResult:(SDLResult *)result info:(NSString *)info;
+ (NSError *)sdl_lifecycle_failedWithBadResult:(SDLResult *)result info:(NSString *)info;
++ (NSError *)sdl_lifecycle_failedWithWarningResult:(SDLResult *)result info:(NSString *)info;
#pragma mark SDLFileManager
diff --git a/SmartDeviceLink/SDLError.m b/SmartDeviceLink/SDLError.m
index 07d28878b..e396c5039 100644
--- a/SmartDeviceLink/SDLError.m
+++ b/SmartDeviceLink/SDLError.m
@@ -94,6 +94,16 @@ SDLErrorDomain *const SDLErrorDomainFileManager = @"com.sdl.filemanager.error";
userInfo:userInfo];
}
++ (NSError *)sdl_lifecycle_failedWithWarningResult:(SDLResult *)result info:(NSString *)info {
+ NSDictionary *userInfo = @{
+ NSLocalizedDescriptionKey: NSLocalizedString(result.value, nil),
+ NSLocalizedFailureReasonErrorKey: NSLocalizedString(info, nil)
+ };
+ return [NSError errorWithDomain:SDLErrorDomainLifecycleManager
+ code:SDLManagerErrorRegistrationWarning
+ userInfo:userInfo];
+}
+
#pragma mark SDLFileManager
diff --git a/SmartDeviceLink/SDLErrorConstants.h b/SmartDeviceLink/SDLErrorConstants.h
index 24d1d58f7..57d1c4fee 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 with a warning.
+ */
+ SDLManagerErrorRegistrationWarning = -7,
};
/**
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index 8f205afd4..7f4fc74d0 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -252,7 +252,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
// If the resultCode isn't success, we got a warning. Errors were handled in `didEnterStateConnected`.
if (![registerResult isEqualToEnum:[SDLResult SUCCESS]]) {
- startError = [NSError sdl_lifecycle_startedWithBadResult:registerResult info:registerInfo];
+ startError = [NSError sdl_lifecycle_failedWithWarningResult:registerResult info:registerInfo];
}
// If we got to this point, we succeeded, send the error if there was a warning.
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index ba680de00..77f6666a7 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -288,7 +288,7 @@ describe(@"a lifecycle manager", ^{
expect(@(readyHandlerSuccess)).to(equal(@YES));
expect(readyHandlerError).toNot(beNil());
- expect(@(readyHandlerError.code)).to(equal(@(SDLManagerErrorRegistrationFailed)));
+ expect(@(readyHandlerError.code)).to(equal(@(SDLManagerErrorRegistrationWarning)));
expect(readyHandlerError.userInfo[NSLocalizedFailureReasonErrorKey]).to(match(response.info));
});
});