Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dart/lib/src/sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ class SentryClient {
count: spanCountBeforeEventProcessors + 1);
}
_options.logger(SentryLevel.debug, 'Event was dropped by a processor');
break;
} else if (event is SentryTransaction &&
processedEvent is SentryTransaction) {
// If event processor removed only some spans we still report them as dropped
Expand Down
14 changes: 12 additions & 2 deletions dart/test/sentry_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ void main() {
});

test('thrown error is handled', () async {
fixture.options.automatedTestMode = false;
final exception = Exception("before send exception");
final beforeSendTransactionCallback = (SentryTransaction event) {
throw exception;
Expand Down Expand Up @@ -1311,6 +1312,7 @@ void main() {
});

test('thrown error is handled', () async {
fixture.options.automatedTestMode = false;
final exception = Exception("before send exception");
final beforeSendCallback = (SentryEvent event, Hint hint) {
throw exception;
Expand Down Expand Up @@ -1604,14 +1606,21 @@ void main() {
});

test('record event processor dropping event', () async {
final client = fixture.getSut(eventProcessor: DropAllEventProcessor());
bool secondProcessorCalled = false;
fixture.options.addEventProcessor(DropAllEventProcessor());
fixture.options.addEventProcessor(FunctionEventProcessor((event, hint) {
secondProcessorCalled = true;
return event;
}));
final client = fixture.getSut();

await client.captureEvent(fakeEvent);

expect(fixture.recorder.discardedEvents.first.reason,
DiscardReason.eventProcessor);
expect(
fixture.recorder.discardedEvents.first.category, DataCategory.error);
expect(secondProcessorCalled, isFalse);
});

test('record event processor dropping transaction', () async {
Expand Down Expand Up @@ -1885,7 +1894,8 @@ class Fixture {
final transport = MockTransport();

final options = SentryOptions(dsn: fakeDsn)
..platformChecker = MockPlatformChecker(platform: MockPlatform.iOS());
..platformChecker = MockPlatformChecker(platform: MockPlatform.iOS())
..automatedTestMode = true;

late SentryTransactionContext _context;
late SentryTracer tracer;
Expand Down