RodrigoSMarques/flutter_branch_sdk

Improve error message with native logs information

Closed this issue · 2 comments

Which problem is this feature request solving?
When receiving an error from Branch, the error looks like:
PlatformException(-116, Trouble initializing Branch. The request was invalid., null, null)

We can't do too much based on the message and code we received.

Describe the solution you'd like
When debugging the app natively and enabling the branch logs, I noticed when an error was thrown, we received:

[branch.io] BNCServerInterface.m(333) Debug: Server returned: [76e38cf7d7e747b8a1f5a5037e61fcb6-2024050215] Status: 400; Data: {
  error =   {
    code = 400;
    message = "Invalid value for property of '$fallback_url', url doesn't pass security tests";
  };
}.
[branch.io] BNCServerInterface.m(158) Error: An error prevented request to https://api3.branch.io/v1/url from completing: Error Domain=io.branch.sdk.error Code=1003 "The network request was invalid." UserInfo={NSLocalizedDescription=The network request was invalid., NSLocalizedFailureReason=The request was invalid.}

The message = "Invalid value for property of '$fallback_url', url doesn't pass security tests"; information is a real game changer, and could help me triage and fix issues that are reported by Sentry, for example (where I can't see the native logs because its errors thrown by the user).

The idea was to add the additional native information into Flutter's PlatformException, and expose it to the app that is using the branch Flutter plugin.

Describe alternatives you've considered

Can you submit a pull request?

Yes/No.

The Flutter plugin retrieves messages from the Branch SDK.

If there is any difference between the API callback and the Flutter plugin, it must be something internal to the native SDK

Captura de Tela 2024-05-05 às 09 35 10 Captura de Tela 2024-05-05 às 09 33 14

Closed. No activity in the last 14 days.
If necessary open again.