Skip to content
Prev Previous commit
Next Next commit
log null scope
  • Loading branch information
rxlabz committed Oct 27, 2020
commit 1e17186eba1abb5f20adbe97e02391c69452718e
6 changes: 5 additions & 1 deletion dart/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ abstract class SentryClient {
return emptyFuture;
}

event = scope?.applyToEvent(event, hint) ?? event;
if (scope != null) {
event = scope.applyToEvent(event, hint);
} else {
_options.logger(SentryLevel.debug, 'No scope is defined');
}

// dropped by scope event processors
if (event == null) {
Expand Down
10 changes: 6 additions & 4 deletions dart/lib/src/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,17 @@ class Scope {
// if the scope and the event have tag entries with the same key,
// the event tags will be keeped
event = event.copyWith(
tags: tags.map((key, value) => MapEntry(key, value))
..addAll(event.tags ?? {}));
tags: tags.map((key, value) => MapEntry(key, value))
..addAll(event.tags ?? {}),
);

// Merge the scope extra.
// if the scope and the event have extra entries with the same key,
// the event extra will be keeped
event = event.copyWith(
extra: extra.map((key, value) => MapEntry(key, value))
..addAll(event.extra ?? {}));
extra: extra.map((key, value) => MapEntry(key, value))
..addAll(event.extra ?? {}),
);

// Merge the scope level.
if (level != null) {
Expand Down