-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
An alternative way to provide correct stacktraces #1723
Conversation
await dio.get('/foo'); | ||
} catch (e, stackTrace) { | ||
expect(stackTrace, isA<Chain>()); | ||
expect(stackTrace.toString(), contains('test/stacktrace_test.dart')); |
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.
We have there correct stacktrace here, something like this:
package:dio/src/dio_mixin.dart 556:7 DioMixin.fetch.<fn>
===== asynchronous gap ===========================
dart:async Future.catchError
package:dio/src/dio_mixin.dart 549:8 DioMixin.fetch
package:dio/src/dio_mixin.dart 392:36 DioMixin.request.<fn>.<fn>
===== asynchronous gap ===========================
dart:async new Future
package:dio/src/dio_mixin.dart 365:15 DioMixin.request.<fn>
package:stack_trace Chain.capture
package:dio/src/dio_mixin.dart 364:13 DioMixin.request
package:dio/src/dio_mixin.dart 63:12 DioMixin.get
test/stacktrace_test.dart 15:19 main.<fn>.<fn>
package:test_api/src/backend/declarer.dart 215:19 Declarer.test.<fn>.<fn>
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.
This looks pretty good, but I am not sure if tooling like Sentry/Crashlytics can work with this.
} catch (e, stackTrace) { | ||
expect(stackTrace, isNot(isA<Chain>())); | ||
expect(stackTrace.toString(), | ||
isNot(contains('test/stacktrace_test.dart'))); |
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.
Here we have no usable stacktrace.
|
If I had to guess, I would think most people are already using a higher Dart version |
I am closing this, this is very interesting with nice stacktraces and all but it is not the way to go inside a library. |
New Pull Request Checklist
main
branch to avoid conflicts (via merge from master or rebase)CHANGELOG.md
in the corresponding packageAdditional context and info (if any)