|
16 | 16 | NSString*const ABEBranchEventType = @"com.branch.eventType"; |
17 | 17 | NSString*const ABEBranchEventSource = @"com.branch.eventSource"; |
18 | 18 |
|
| 19 | +// Adobe Launch Branch extension error domain |
| 20 | +NSString*const AdobeBranchExtensionErrorDomain = @"io.branch.adobe_launch_extension.error"; |
| 21 | + |
19 | 22 | // 1. events of this type and source |
20 | 23 | NSString *const ABEAdobeHubEventType = @"com.adobe.eventType.hub"; |
21 | 24 | NSString *const ABEAdobeSharedStateEventSource = @"com.adobe.eventSource.sharedState"; |
@@ -93,32 +96,32 @@ + (void)configureEventTypes:(nullable NSArray<NSString *> *)eventTypes andEventS |
93 | 96 | } |
94 | 97 | } |
95 | 98 |
|
96 | | -+ (void)configureEventExclusionList:(nullable NSArray<NSString *> *)eventNames { |
| 99 | ++ (BOOL)configureEventExclusionList:(nullable NSArray<NSString *> *)eventNames error:(NSError * __autoreleasing *)configError { |
97 | 100 | if (eventNames) { |
98 | 101 | // If already configured allowList |
99 | 102 | if ([AdobeBranchExtensionConfig instance].allowList.count != 0) { |
100 | | - @throw [NSException |
101 | | - exceptionWithName:@"ConflictConfiguration" |
102 | | - reason:@"Already configured allowList for AdobeBranchExtensionConfig" |
103 | | - userInfo:nil]; |
| 103 | + *configError = [NSError errorWithDomain:AdobeBranchExtensionErrorDomain code:ABEBranchConflictConfiguration userInfo:@{NSLocalizedFailureReasonErrorKey: @"Already configured allowList for AdobeBranchExtensionConfig"}]; |
| 104 | + BNCLogError([NSString stringWithFormat:@"AdobeBranchExtensionConfig error: %@.", *configError]); |
| 105 | + return NO; |
104 | 106 | } else { |
105 | 107 | [AdobeBranchExtensionConfig instance].exclusionList = eventNames; |
106 | 108 | } |
107 | 109 | } |
| 110 | + return YES; |
108 | 111 | } |
109 | 112 |
|
110 | | -+ (void)configureEventAllowList:(nullable NSArray<NSString *> *)eventNames { |
| 113 | ++ (BOOL)configureEventAllowList:(nullable NSArray<NSString *> *)eventNames error:(NSError * __autoreleasing *)configError { |
111 | 114 | if (eventNames) { |
112 | 115 | // If already configured allowList |
113 | 116 | if ([AdobeBranchExtensionConfig instance].exclusionList.count != 0) { |
114 | | - @throw [NSException |
115 | | - exceptionWithName:@"ConflictConfiguration" |
116 | | - reason:@"Already configured exclusionList for AdobeBranchExtensionConfig" |
117 | | - userInfo:nil]; |
| 117 | + *configError = [NSError errorWithDomain:AdobeBranchExtensionErrorDomain code:ABEBranchConflictConfiguration userInfo:@{NSLocalizedFailureReasonErrorKey: @"Already configured exclusionList for AdobeBranchExtensionConfig"}]; |
| 118 | + BNCLogError([NSString stringWithFormat:@"AdobeBranchExtensionConfig error: %@.", *configError]); |
| 119 | + return NO; |
118 | 120 | } else { |
119 | 121 | [AdobeBranchExtensionConfig instance].allowList = eventNames; |
120 | 122 | } |
121 | 123 | } |
| 124 | + return YES; |
122 | 125 | } |
123 | 126 |
|
124 | 127 | - (instancetype)init { |
|
0 commit comments