Skip to content

PlatformException.message should be treated like PlatformException.stacktrace #1708

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

Closed
ueman opened this issue Nov 1, 2023 · 3 comments · Fixed by #1716
Closed

PlatformException.message should be treated like PlatformException.stacktrace #1708

ueman opened this issue Nov 1, 2023 · 3 comments · Fixed by #1716

Comments

@ueman
Copy link
Collaborator

ueman commented Nov 1, 2023

Problem Statement

In theory, only PlatformException.stacktrace should contain a stacktrace. However, in practice I see a lot of plugins misusing the PlatformException.message field for stacktraces.

Solution Brainstorm

Therefore, it would be nice if the PlatformException.message field could be treated like the PlatformException.stacktrace field.

Are you willing to submit a PR?

Yes

@buenaflor
Copy link
Contributor

Do you have an example of how it's misused? Not sure if I understand correctly if message doesn't contain a stacktrace

@ueman
Copy link
Collaborator Author

ueman commented Nov 2, 2023

Sure.

Here's an example where a native stacktrace is passed to Flutter in the PlatformException.message field:

Screenshot 2023-11-02 at 10 40 05

As you can see, it's not really well formatted and Sentry could do better.

Here's an example of how it looks like when the native stacktrace is passed via the PlatformException.stacktrace field and how I want it to look like for the example above

Screenshot 2023-11-02 at 10 41 56

It should be a straight forward change in the following file https://github.com/getsentry/sentry-dart/blob/955541a50762f04c301c83eb25aef0077742c29a/flutter/lib/src/event_processor/android_platform_exception_event_processor.dart

Basically the new logic should be in case PlatformException.stacktrace is null, try to parse PlatformException.message instead.

@buenaflor
Copy link
Contributor

I see, makes sense if it is parsed as a fallback 👍

@buenaflor buenaflor moved this from Needs Discussion to Backlog in [DEPRECATED] Mobile SDKs Nov 9, 2023
@buenaflor buenaflor moved this from Backlog to Todo in [DEPRECATED] Mobile SDKs Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants