Skip to content
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

[Feature]: Callback for addAlias Function in Swift SDK for Enhanced Error Handling #129

Open
initishbhatt opened this issue May 30, 2024 · 4 comments

Comments

@initishbhatt
Copy link

What problem are you facing?

we are currently using the Braze Swift SDK in our application and have encountered issues with the addAlias function. Specifically, we have observed instances where the alias is not being registered, but there is no callback or error handling mechanism to inform me of this failure. This lack of feedback makes it challenging to diagnose and address the issue effectively.

While using the addAlias function, there are occasions where the alias addition fails silently. Without a callback or error reporting mechanism, it's difficult to determine whether the alias was successfully added or why it failed. This hinders our ability to ensure reliable user identity management within our application.

Workarounds

no clean solution at the moment

Ideal Solution

The addAlias function in the Braze Swift SDK be updated to include a callback that provides feedback on the status of the alias addition. This callback should offer:

  • A success indicator (e.g., a Boolean value).

  • In case of failure, a reason for the error (e.g., network issues, invalid alias, etc.).

Use Case:

This feature is essential for scenarios where it is crucial to know if an alias has been successfully added. For example, in applications where user identity management is critical, knowing the outcome of the alias addition allows developers to take appropriate actions based on the result.

Proposed Implementation:

An example of how this might look :

Braze.sharedInstance()?.user.add(alias: "alias", label: "label") { success, error in
    if success {
        print("Alias added successfully")
    } else {
        if let error = error {
            print("Failed to add alias: \(error.localizedDescription)")
        } else {
            print("Failed to add alias for an unknown reason")
        }
    }
}

Other Information

No response

@jerielng
Copy link
Collaborator

Hi @initishbhatt, thanks for your request! At the moment, our add(alias:label:) method does check and log errors if the alias is not valid, so you should be seeing some output in your verbose logs in such cases. Let us know if that's not the behavior you're observing.

Are there other cases where you would require further functionality with a completion handler?

@initishbhatt
Copy link
Author

Hi @initishbhatt, thanks for your request! At the moment, our add(alias:label:) method does check and log errors if the alias is not valid, so you should be seeing some output in your verbose logs in such cases. Let us know if that's not the behavior you're observing.

Are there other cases where you would require further functionality with a completion handler?

Hi @jerielng i see that there is an option to log error but this happens sporadically so it becomes difficult to understand the root cause of failure, since the log lives locally
providing a callback gives us an option to re-trigger the addAlias call in case of failure and would allow use to log those errors in a monitoring tool like Sentry or Crashlytics for further analysis.

@jerielng
Copy link
Collaborator

jerielng commented Jun 3, 2024

@initishbhatt That makes sense - thank you for your feedback! Since this would be a feature request, could you file it here to route it to our product teams for prioritization?

@jerielng
Copy link
Collaborator

jerielng commented Jun 3, 2024

Additionally, could you also clarify what type of errors you are seeing? When you mention that it happens sporadically, are you seeing failures when you don't expect them? It would help to know the type of values you are logging for aliases in case there is something deeper that might be occurring that is outside of intended behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants