Skip to content

Commit

Permalink
In the Event.exception constructor, modify a clone of the args ar…
Browse files Browse the repository at this point in the history
…gument instead of `args` itself (#1201)
  • Loading branch information
andrewkolos authored Nov 21, 2024
1 parent c39ce5f commit 4c2ff99
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cli_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all

on:
pull_request:
branches: [main]
paths:
- ".github/workflows/cli_config.yml"
- "pkgs/cli_config/**"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/extension_discovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all

on:
pull_request:
branches: [ main ]
paths:
- '.github/workflows/unified_analytics.yml'
- 'pkgs/extension_discovery/**'
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/graphs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ name: package:graphs
permissions: read-all

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
# Run CI on all PRs (against any branch) and on pushes to the main branch.
pull_request:
paths:
- '.github/workflows/graphs.yml'
- 'pkgs/graphs/**'
pull_request:
push:
branches: [ main ]
paths:
- '.github/workflows/graphs.yml'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/unified_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all

on:
pull_request:
branches: [ main ]
paths:
- '.github/workflows/unified_analytics.yml'
- 'pkgs/unified_analytics/**'
Expand Down
3 changes: 3 additions & 0 deletions pkgs/unified_analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 6.1.6
- Fixed `UnsupportedError` thrown when Event.exception is called without providing a value for `args`.

## 6.1.5
- Remove any `data` entries with a null value in the `Event.exception` constructor.

Expand Down
4 changes: 2 additions & 2 deletions pkgs/unified_analytics/lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const String kConfigString = '''
# All other lines are configuration lines. They have
# the form "name=value". If multiple lines contain
# the same configuration name with different values,
# the parser will default to a conservative value.
# the parser will default to a conservative value.
# DISABLING TELEMETRY REPORTING
#
Expand Down Expand Up @@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20);
const String kLogFileName = 'dart-flutter-telemetry.log';

/// The current version of the package, should be in line with pubspec version.
const String kPackageVersion = '6.1.5';
const String kPackageVersion = '6.1.6';

/// The minimum length for a session.
const int kSessionDurationMinutes = 30;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/unified_analytics/lib/src/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ final class Event {
}) : eventName = DashEvent.exception,
eventData = {
'exception': exception,
...data..removeWhere((key, value) => value == null),
...Map.from(data)..removeWhere((key, value) => value == null),
};

/// Event that is emitted from the flutter tool when a build invocation
Expand Down
2 changes: 1 addition & 1 deletion pkgs/unified_analytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >-
# LINT.IfChange
# When updating this, keep the version consistent with the changelog and the
# value in lib/src/constants.dart.
version: 6.1.5
version: 6.1.6
# LINT.ThenChange(lib/src/constants.dart)
repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics

Expand Down
8 changes: 8 additions & 0 deletions pkgs/unified_analytics/test/event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,14 @@ void main() {
expect(constructedEvent.eventData.length, 3);
});

test('Event.exception constructor works when no data is provided', () {
Event generateEvent() => Event.exception(
exception: 'exception',
);

expect(generateEvent, returnsNormally);
});

test('Event.timing constructed', () {
Event generateEvent() => Event.timing(
workflow: 'workflow',
Expand Down

0 comments on commit 4c2ff99

Please sign in to comment.