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

Add a way to extract stacktraces from custom exception types #1335

Merged
merged 4 commits into from
Mar 16, 2023

Conversation

kuhnroyal
Copy link
Contributor

📜 Description

  • add ExceptionStackTraceExtractor and use as fallback in SentryExceptionFactory
  • add DioStackTraceExtractor to the dio module which extracts DioError.stackTrace

💡 Motivation and Context

See discussion in #1323
Fixes #1322

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

CC @ueman @marandaneto

* add `ExceptionStackTraceExtractor` and use as fallback in `SentryExceptionFactory`
* add `DioStackTraceExtractor` to the dio module which extracts `DioError.stackTrace`
@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (689d2fd) 90.29% compared to head (d067205) 90.31%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1335      +/-   ##
==========================================
+ Coverage   90.29%   90.31%   +0.02%     
==========================================
  Files         168      170       +2     
  Lines        5254     5266      +12     
==========================================
+ Hits         4744     4756      +12     
  Misses        510      510              
Impacted Files Coverage Δ
dart/lib/src/exception_stacktrace_extractor.dart 100.00% <100.00%> (ø)
dart/lib/src/sentry_exception_factory.dart 100.00% <100.00%> (ø)
dart/lib/src/sentry_options.dart 83.72% <100.00%> (+0.79%) ⬆️
dio/lib/src/dio_stacktrace_extractor.dart 100.00% <100.00%> (ø)
dio/lib/src/sentry_dio_extension.dart 94.44% <100.00%> (+0.69%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kuhnroyal
Copy link
Contributor Author

Hmm no idea about the failing workflows.

/// Extracts the inner stacktrace from [DioError]
class DioStackTraceExtractor extends ExceptionStackTraceExtractor<DioError> {
@override
StackTrace? stackTrace(DioError error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
StackTrace? stackTrace(DioError error) {
dynamic stackTrace(DioError error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is fine, for DioError the type can be tightened.

@marandaneto
Copy link
Contributor

Hmm no idea about the failing workflows.

The analyze one is due to dart-lang/pana#1020
All good.
The other one is a timeout, related to dart-lang/test#1622 most likely, so all good as well.

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kuhnroyal
Left a few comments but other than that LGTM

@marandaneto marandaneto merged commit 1ab55fc into getsentry:main Mar 16, 2023
@kuhnroyal kuhnroyal deleted the feat/stacktrace-extractor branch March 17, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DioError extractor extracts wrong stacktrace
2 participants