summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-01-18 20:50:42 -0800
committerMuller, Alexander (A.) <amulle19@ford.com>2017-01-18 20:50:42 -0800
commit1c280c1c21998f4781fca445a034e3d6c7e443ad (patch)
treea80d6318913b604d90ea6d70813ef0fe7d01457a
parent20204d65066edf715dbcccef3fbd642fb6d70454 (diff)
downloadsdl_ios-1c280c1c21998f4781fca445a034e3d6c7e443ad.tar.gz
Updated to throw an exception instead of returning an error for nil requests being sent.hotfix/issue_499
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m9
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m9
2 files changed, 6 insertions, 12 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index d13a27050..6b08bdd28 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -369,11 +369,10 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
// If, for some reason, the request is nil we should error out.
if (!request) {
- [SDLDebugTool logInfo:@"Attempting to send a nil request, request not sent."];
- if (handler) {
- handler(nil, nil, [NSError sdl_lifecycle_rpcErrorWithDescription:@"Nil Request" andReason:@"Request must not be nil"]);
- }
- return;
+ @throw [NSException
+ exceptionWithName:NSInvalidArgumentException
+ reason:@"A Request cannot be nil."
+ userInfo:nil];
}
// Add a correlation ID to the request
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index cbee22384..d98c6269e 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -266,14 +266,9 @@ describe(@"a lifecycle manager", ^{
});
it(@"cannot send a nil RPC", ^{
- __block NSError* testError = nil;
SDLShow *testShow = nil;
-
- [testManager sendRequest:testShow withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
- testError = error;
- }];
-
- expect(testError).to(equal([NSError sdl_lifecycle_rpcErrorWithDescription:@"Nil Request" andReason:@"Request must not be nil"]));
+
+ expectAction(^{ [testManager sendRequest:testShow]; }).to(raiseException().named(NSInvalidArgumentException));
});
describe(@"stopping the manager", ^{