@@ -164,7 +164,8 @@ class SentryClient {
164
164
'${dsnUri .scheme }://${dsnUri .host }/api/$projectId /store/' ;
165
165
166
166
/// Reports an [event] to Sentry.io.
167
- Future <SentryResponse > capture ({@required Event event}) async {
167
+ Future <SentryResponse > capture (
168
+ {@required Event event, StackFrameFilter stackFrameFilter}) async {
168
169
final DateTime now = _clock ();
169
170
String authHeader = 'Sentry sentry_version=6, sentry_client=$sentryClient , '
170
171
'sentry_timestamp=${now .millisecondsSinceEpoch }, sentry_key=$publicKey ' ;
@@ -192,7 +193,8 @@ class SentryClient {
192
193
if (userContext != null ) {
193
194
mergeAttributes ({'user' : userContext.toJson ()}, into: data);
194
195
}
195
- mergeAttributes (event.toJson (), into: data);
196
+ mergeAttributes (event.toJson (stackFrameFilter: stackFrameFilter),
197
+ into: data);
196
198
197
199
List <int > body = utf8.encode (json.encode (data));
198
200
if (compressPayload) {
@@ -216,15 +218,19 @@ class SentryClient {
216
218
}
217
219
218
220
/// Reports the [exception] and optionally its [stackTrace] to Sentry.io.
221
+ ///
222
+ /// Optionally allows specifying a [stackFrameFilter] that receives the
223
+ /// list of stack frames just before sending to allow modifying it.
219
224
Future <SentryResponse > captureException ({
220
225
@required dynamic exception,
221
226
dynamic stackTrace,
227
+ StackFrameFilter stackFrameFilter,
222
228
}) {
223
229
final Event event = new Event (
224
230
exception: exception,
225
231
stackTrace: stackTrace,
226
232
);
227
- return capture (event: event);
233
+ return capture (event: event, stackFrameFilter : stackFrameFilter );
228
234
}
229
235
230
236
Future <Null > close () async {
@@ -376,7 +382,7 @@ class Event {
376
382
final List <String > fingerprint;
377
383
378
384
/// Serializes this event to JSON.
379
- Map <String , dynamic > toJson () {
385
+ Map <String , dynamic > toJson ({ StackFrameFilter stackFrameFilter} ) {
380
386
final Map <String , dynamic > json = < String , dynamic > {
381
387
'platform' : sdkPlatform,
382
388
'sdk' : {
@@ -406,7 +412,8 @@ class Event {
406
412
407
413
if (stackTrace != null ) {
408
414
json['stacktrace' ] = < String , dynamic > {
409
- 'frames' : encodeStackTrace (stackTrace),
415
+ 'frames' :
416
+ encodeStackTrace (stackTrace, stackFrameFilter: stackFrameFilter),
410
417
};
411
418
}
412
419
0 commit comments