-
-
Notifications
You must be signed in to change notification settings - Fork 277
Feat: Add some more information for exceptions collected via FlutterError.onError
#538
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #538 +/- ##
=======================================
Coverage 91.55% 91.55%
=======================================
Files 74 74
Lines 2428 2428
=======================================
Hits 2223 2223
Misses 205 205 Continue to review full report at Codecov.
|
bruno-garcia
left a comment
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.
How often can the information field be larger than what Sentry can display properly? It transforms an array into a single line, so it could end up truncated or not fitting the UI very well. Perhaps we need to find another way to present it?
Hard to say as its origin can be the Flutter framework, libraries and developers themselves.
What would be a better way to display this? The events data could be another place for this, but then the information would be visually disconnected in the Sentry UI :( |
Co-authored-by: Bruno Garcia <[email protected]>
|
It doesn't play nicely if it's really long :( I raised an issue for this little UI bug here: getsentry/sentry#27737 |
| RaisedButton( | ||
| child: const Text('Capture from FlutterError.onError'), | ||
| onPressed: () { | ||
| // modeled after a real exception | ||
| FlutterError.onError?.call(FlutterErrorDetails( | ||
| exception: Exception('A really bad exception'), | ||
| silent: false, | ||
| context: DiagnosticsNode.message('while handling a gesture'), | ||
| library: 'gesture', | ||
| informationCollector: () => [ | ||
| DiagnosticsNode.message( | ||
| 'Handler: "onTap" Recognizer: TapGestureRecognizer'), | ||
| DiagnosticsNode.message( | ||
| 'Handler: "onTap" Recognizer: TapGestureRecognizer'), | ||
| DiagnosticsNode.message( | ||
| 'Handler: "onTap" Recognizer: TapGestureRecognizer'), | ||
| ], | ||
| )); | ||
| }, | ||
| ), |
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.
the example Flutter error : Scaffold.of() already triggers a FlutterError.onError error, isnt that enough? is it common that people trigger FlutterError.onError manually too?
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.
the example Flutter error : Scaffold.of() already triggers a FlutterError.onError error, isnt that enough?
This is just to test how it looks in the Sentry UI when it has a long trail of information, which Flutter error : Scaffold.of() doesn't have (as seen in the screenshot of the PR description). We can remove it before merging.
is it common that people trigger FlutterError.onError manually too?
No, but it's not uncommon in libraries.
|
@ueman is this ready to be merged or the multiple line thing should be tested? |
It works and is tested but it could be that it doesn't look that good in the Sentry UI for long information. So unless you or @bruno-garcia has a better idea where to put the information this is good to go. I tried to add it to the events extra data, but then this information kinda gets lost. |
what do you mean by kinda get lost? does it make to Sentry or not easy to find since the information is down there in the additional data? |
It gets visually lost when it at the same place as all the device, os and app information. It does make to Sentry so it's not a bug. I'll add some pictures later to clarify what I mean :D |
|
This event has the data added to the mechanism and as the |
|
I'm a bit wary of adding data that'll be potentially large in that field in this form. Perhaps best we find a way to break in up in more 'key/value' pairs |
|
This is looks amazing for us, as we have 3 different flutter apps all using this context data and we've only just realized it's missing. Very keen to help out in any way that I can. |
Thanks! That's really appreciated.
|
|
Our context fields are typically 3-4 words, similar length to your example. We have none longer than 36 characters. I'm afraid we've never seen information values in practice, as Sentry isn't capturing them :P. Looking at the definition of FlutterErrorDetails, it seems reasonable to suggest these should be key/value pairs, but as far as I can tell you could only split on the newlines that may or may not exist. Seems fine for most use-cases? I don't know a lot about the Sentry UI though sorry. A neat UX might be that if a tag is too long up the top, it is cut off and can be clicked to scroll down to the full value. |
|
Okay, I've changed it so that the mechanism has a tag which tells the user to look for a |


📜 Description
The information in the red square is added by this PR.
💡 Motivation and Context
💚 How did you test it?
Changed test accordingly
📝 Checklist
🔮 Next steps