summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Elias <francois.elias@livio.io>2021-01-25 17:27:10 -0500
committerFrank Elias <francois.elias@livio.io>2021-01-25 17:27:10 -0500
commit2e63575648f611e0ee8941509d2abcf5883f3dd5 (patch)
tree90e4c198a35a24231f75f3f00d85e2e2184904f8
parentff81c9bce110f7798520fdfeaed4bbb4d7722911 (diff)
downloadsdl_ios-2e63575648f611e0ee8941509d2abcf5883f3dd5.tar.gz
New exception added to handle SDLSoftButtonManager
-rw-r--r--SmartDeviceLink/private/SDLError.h1
-rw-r--r--SmartDeviceLink/private/SDLError.m4
-rw-r--r--SmartDeviceLink/private/SDLSoftButtonManager.m2
3 files changed, 6 insertions, 1 deletions
diff --git a/SmartDeviceLink/private/SDLError.h b/SmartDeviceLink/private/SDLError.h
index fae799fe9..81956b831 100644
--- a/SmartDeviceLink/private/SDLError.h
+++ b/SmartDeviceLink/private/SDLError.h
@@ -95,6 +95,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface NSException (SDLExceptions)
++ (NSException *)sdl_duplicateSoftButtonsTitleException;
+ (NSException *)sdl_missingHandlerException;
+ (NSException *)sdl_missingIdException;
+ (NSException *)sdl_missingFilesException;
diff --git a/SmartDeviceLink/private/SDLError.m b/SmartDeviceLink/private/SDLError.m
index a54cee83e..81616bf79 100644
--- a/SmartDeviceLink/private/SDLError.m
+++ b/SmartDeviceLink/private/SDLError.m
@@ -407,6 +407,10 @@ NS_ASSUME_NONNULL_BEGIN
@implementation NSException (SDLExceptions)
++ (NSException *)sdl_duplicateSoftButtonsTitleException {
+ return [NSException exceptionWithName:@"InvalidSoftButtonsInitialization" reason:@"Attempting to create soft buttons with the same title" userInfo:nil];
+}
+
+ (NSException *)sdl_missingHandlerException {
return [NSException
exceptionWithName:@"MissingHandlerException"
diff --git a/SmartDeviceLink/private/SDLSoftButtonManager.m b/SmartDeviceLink/private/SDLSoftButtonManager.m
index 7a7605d22..6075d452e 100644
--- a/SmartDeviceLink/private/SDLSoftButtonManager.m
+++ b/SmartDeviceLink/private/SDLSoftButtonManager.m
@@ -133,7 +133,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([softButtonObjects[j].name isEqualToString:buttonName]) {
_softButtonObjects = @[];
SDLLogE(@"Attempted to set soft button objects, but two buttons had the same name: %@", softButtonObjects);
- return;
+ @throw [NSException sdl_duplicateSoftButtonsTitleException];
}
}
}