File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
import 'dart:async' ;
2
2
import 'dart:math' ;
3
3
import 'package:meta/meta.dart' ;
4
+ import 'utils/stacktrace_utils.dart' ;
4
5
import 'metrics/metric.dart' ;
5
6
import 'metrics/metrics_aggregator.dart' ;
6
7
import 'sentry_baggage.dart' ;
@@ -235,7 +236,7 @@ class SentryClient {
235
236
// therefore add it to the threads.
236
237
// https://develop.sentry.dev/sdk/event-payloads/stacktrace/
237
238
if (stackTrace != null || _options.attachStacktrace) {
238
- stackTrace ?? = StackTrace .current ;
239
+ stackTrace ?? = getCurrentStackTrace () ;
239
240
final frames = _stackTraceFactory.getStackFrames (stackTrace);
240
241
241
242
if (frames.isNotEmpty) {
Original file line number Diff line number Diff line change
1
+ import 'utils/stacktrace_utils.dart' ;
2
+
1
3
import 'recursive_exception_cause_extractor.dart' ;
2
4
import 'protocol.dart' ;
3
5
import 'sentry_options.dart' ;
@@ -40,7 +42,7 @@ class SentryExceptionFactory {
40
42
if (_options.attachStacktrace) {
41
43
if (stackTrace == null || stackTrace == StackTrace .empty) {
42
44
snapshot = true ;
43
- stackTrace = StackTrace .current ;
45
+ stackTrace = getCurrentStackTrace () ;
44
46
}
45
47
}
46
48
Original file line number Diff line number Diff line change
1
+ import 'package:meta/meta.dart' ;
2
+
3
+ // A wrapper function around StackTrace.current so we can ignore it in the SDK
4
+ // crash detection. Otherwise, the SDK crash detection would have to ignore the
5
+ // method calling StackTrace.current, and it can't detect crashes in that
6
+ // method.
7
+ // You can read about the SDK crash detection here:
8
+ // https://github.com/getsentry/sentry/blob/master/src/sentry/utils/sdk_crashes/README.rst
9
+ @internal
10
+ StackTrace getCurrentStackTrace () => StackTrace .current;
You can’t perform that action at this time.
0 commit comments