Repository navigation
fix: [SDK-5537] log handled failures and setup mistakes below ERROR #1778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4c1b871
3d4fbc8
abe8d82
6a669c5
41d0146
38b515a
43161fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,7 +153,10 @@ + (void)onNotificationReceived:(NSString *)receivedNotificationId withBlockingTa | |
| dispatch_semaphore_signal(semaphore); | ||
| } | ||
| } failureBlock:^(NSError *error) { | ||
| [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"OneSignal onNotificationReceived sendReceiveReceipt Failed for playerId: %@ error: %@", playerId, error]]; | ||
| // The error is nil when no receipt was attempted, such as when receipts are disabled. | ||
| if (error) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HTTP failures still reach here with a synthesized
|
||
| [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"OneSignal onNotificationReceived sendReceiveReceipt Failed for playerId: %@ error: %@", playerId, error]]; | ||
| } | ||
| if (semaphore) { | ||
| dispatch_semaphore_signal(semaphore); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -657,7 +657,7 @@ - (void)resetRedisplayMessagesBySession { | |
|
|
||
| - (void)deleteInactiveMessage:(OSInAppMessageInternal *)message { | ||
| let deleteMessage = [NSString stringWithFormat:@"Deleting inactive in-app message from cache: %@", message.messageId]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:deleteMessage]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:deleteMessage]; | ||
| NSMutableArray *newMessagesArray = [NSMutableArray arrayWithArray:self.messages]; | ||
| [newMessagesArray removeObject: message]; | ||
| self.messages = newMessagesArray; | ||
|
|
@@ -872,7 +872,7 @@ - (void)messageViewPageImpressionRequest:(OSInAppMessageInternal *)message withP | |
| } | ||
| onFailure:^(OneSignalClientError *error) { | ||
| NSString *errorMessage = [NSString stringWithFormat:@"In App Message with message id: %@ and page id: %@, failed POST page impression update with error: %@", message.messageId, pageId, error.message]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; | ||
| if (message) { | ||
| [self.viewedPageIDs removeObject:messagePrefixedPageId]; | ||
| } | ||
|
|
@@ -912,7 +912,7 @@ - (void)messageViewImpressionRequest:(OSInAppMessageInternal *)message { | |
| } | ||
| onFailure:^(OneSignalClientError *error) { | ||
| NSString *errorMessage = [NSString stringWithFormat:@"In App Message with id: %@, failed POST impression update with error: %@", message.messageId, error.message]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for the page-impression and click POSTs below. These are not retried automatically; clearing the local set only helps if the message shows or the user clicks again. WARN to match content-load, or call out the INFO choice in the PR body. |
||
|
|
||
| // If the post failed, remove the messageId from the impressionedInAppMessages set | ||
| [self.impressionedInAppMessages removeObject:message.messageId]; | ||
|
|
@@ -1333,7 +1333,7 @@ - (void)sendClickRESTCall:(OSInAppMessageInternal *)message withAction:(OSInAppM | |
| } | ||
| onFailure:^(OneSignalClientError *error) { | ||
| NSString *errorMessage = [NSString stringWithFormat:@"In App Message with id: %@, failed POST click update for click id: %@, with error: %@", message.messageId, action.clickId, error.message]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; | ||
|
|
||
| // Remove clickId from local clickedClickIds since click was not tracked | ||
| [self.clickedClickIds removeObject:action.clickId]; | ||
|
|
@@ -1359,7 +1359,7 @@ - (void)sendOutcomes:(NSArray<OSInAppMessageOutcome *>*)outcomes forMessageId:(N | |
|
|
||
| - (void)sendClickActionOutcomes:(NSArray<OSInAppMessageOutcome *> *)outcomes { | ||
| if (![OSOutcomes sharedController]) { | ||
| [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Make sure OneSignal init is called first"]; | ||
| [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Make sure OneSignal init is called first"]; | ||
| return; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also swallows HTTP failures. The controller forwards
error.underlyingError, andOneSignalClientleaves that nil for status responses, so a 4xx/5xx arrives asfailure(nil)and logs nothing. Disabled receipts use the same nil.Pass the
OneSignalClientErrorthrough (or a skip callback for disabled/missing appId). WARN on real attempt failures; stay quiet only when nothing was sent.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTP failures still log.
OneSignalClientErrorfillsunderlyingErrorwith an NSError carrying the status code when there is no transport error (OneSignalClientError.m, in the initializer). So a 4xx or 5xx reaches this block with an error and logs WARN. Only the twofailure(nil)calls, for a missing app ID and for disabled receipts, stay quiet.