File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import 'protocol.dart';
3
3
import 'sentry_options.dart' ;
4
4
import 'sentry_stack_trace_factory.dart' ;
5
5
import 'throwable_mechanism.dart' ;
6
+ import 'utils/stack_trace_utils.dart' ;
6
7
7
8
/// class to convert Dart Error and exception to SentryException
8
9
class SentryExceptionFactory {
@@ -57,11 +58,13 @@ class SentryExceptionFactory {
57
58
}
58
59
}
59
60
61
+ final throwableString = throwable.toString ();
62
+
60
63
// if --obfuscate feature is enabled, 'type' won't be human readable.
61
64
// https://flutter.dev/docs/deployment/obfuscate#caveat
62
65
return SentryException (
63
66
type: (throwable.runtimeType).toString (),
64
- value: throwable. toString () ,
67
+ value: throwableString. isStackTrace () ? null : throwableString ,
65
68
mechanism: mechanism,
66
69
stackTrace: sentryStackTrace,
67
70
throwable: throwable,
Original file line number Diff line number Diff line change @@ -169,6 +169,13 @@ void main() {
169
169
170
170
expect (sentryException.throwable, throwable);
171
171
});
172
+
173
+ test ('should not assigns stackTrace string to value' , () {
174
+ final stackTraceError = StackTraceError ();
175
+ final sentryException =
176
+ fixture.getSut ().getSentryException (stackTraceError);
177
+ expect (sentryException.value, isNull);
178
+ });
172
179
}
173
180
174
181
class CustomError extends Error {}
@@ -187,6 +194,17 @@ class CustomExceptionStackTraceExtractor
187
194
}
188
195
}
189
196
197
+ class StackTraceError extends Error {
198
+ @override
199
+ String toString () {
200
+ return '''
201
+ #0 baz (file:///pathto/test.dart:50:3)
202
+ <asynchronous suspension>
203
+ #1 bar (file:///pathto/test.dart:46:9)
204
+ ''' ;
205
+ }
206
+ }
207
+
190
208
class Fixture {
191
209
final options = SentryOptions (dsn: fakeDsn);
192
210
You can’t perform that action at this time.
0 commit comments