Skip to content

Commit ef0d966

Browse files
committed
Merge branch 'main' into feat/unknown-serialization
2 parents 91458ee + c19bfb6 commit ef0d966

File tree

60 files changed

+812
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+812
-99
lines changed

.github/workflows/flutter_integration_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: flutter pub get
5050

5151
- name: Gradle cache
52-
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # pin@v3.4.2
52+
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # pin@v3.5.0
5353

5454
- name: AVD cache
5555
uses: actions/cache@v4

.github/workflows/flutter_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: flutter pub get
5555

5656
- name: Gradle cache
57-
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # [email protected]
57+
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # [email protected]
5858

5959
- name: AVD cache
6060
uses: actions/cache@v4

.github/workflows/testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # [email protected]
1818
- run: xcodes select 15.0.1
19-
- uses: ruby/setup-ruby@3a77c29278ae80936b4cb030fefc7d21c96c786f # pin@v1.185.0
19+
- uses: ruby/setup-ruby@50ba3386b050ad5b97a41fcb81240cbee1d1821f # pin@v1.188.0
2020
with:
2121
ruby-version: '2.7.5'
2222
bundler-cache: true

CHANGELOG.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,77 @@
55
### Improvements
66

77
- Deserialize and serialize unknown fields ([#2153](https://github.com/getsentry/sentry-dart/pull/2153))
8+
## Unreleased
9+
10+
### Improvements
11+
12+
- Add error type identifier to improve obfuscated Flutter issue titles ([#2170](https://github.com/getsentry/sentry-dart/pull/2170))
13+
- Example: transforms issue titles from `GA` to `FlutterError` or `minified:nE` to `FlutterError`
14+
- This is enabled automatically and will change grouping if you already have issues with obfuscated titles
15+
- If you want to disable this feature, set `enableExceptionTypeIdentification` to `false` in your Sentry options
16+
- You can add your custom exception identifier if there are exceptions that we do not identify out of the box
17+
```dart
18+
// How to add your own custom exception identifier
19+
class MyCustomExceptionIdentifier implements ExceptionIdentifier {
20+
@override
21+
String? identifyType(Exception exception) {
22+
if (exception is MyCustomException) {
23+
return 'MyCustomException';
24+
}
25+
if (exception is MyOtherCustomException) {
26+
return 'MyOtherCustomException';
27+
}
28+
return null;
29+
}
30+
}
31+
32+
SentryFlutter.init((options) =>
33+
options..prependExceptionTypeIdentifier(MyCustomExceptionIdentifier()));
34+
```
35+
36+
### Deprecated
37+
38+
- Deprecate `enableTracing` ([#2199](https://github.com/getsentry/sentry-dart/pull/2199))
39+
- The `enableTracing` option has been deprecated and will be removed in the next major version. We recommend removing it
40+
in favor of the `tracesSampleRate` and `tracesSampler` options. If you want to enable performance monitoring, please set
41+
the `tracesSampleRate` to a sample rate of your choice, or provide a sampling function as `tracesSampler` option
42+
instead. If you want to disable performance monitoring, remove the `tracesSampler` and `tracesSampleRate` options.
43+
44+
### Dependencies
45+
46+
- Bump Android SDK from v7.12.0 to v7.12.1 ([#2198](https://github.com/getsentry/sentry-dart/pull/2198))
47+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7121)
48+
- [diff](https://github.com/getsentry/sentry-java/compare/7.12.0...7.12.1)
49+
50+
## 8.5.0
51+
52+
### Features
53+
54+
- Add dart platform to sentry frames ([#2193](https://github.com/getsentry/sentry-dart/pull/2193))
55+
- This allows viewing the correct dart formatted raw stacktrace in the Sentry UI
56+
- Support `ignoredExceptionsForType` ([#2150](https://github.com/getsentry/sentry-dart/pull/2150))
57+
- Filter out exception types by calling `SentryOptions.addExceptionFilterForType(Type exceptionType)`
58+
59+
### Fixes
60+
61+
- Disable sff & frame delay detection on web, linux and windows ([#2182](https://github.com/getsentry/sentry-dart/pull/2182))
62+
- Display refresh rate is locked at 60 for these platforms which can lead to inaccurate metrics
63+
64+
### Improvements
65+
66+
- Capture meaningful stack traces when unhandled errors have empty or missing stack traces ([#2152](https://github.com/getsentry/sentry-dart/pull/2152))
67+
- This will affect grouping for unhandled errors that have empty or missing stack traces.
68+
69+
### Dependencies
70+
71+
- Bump Android SDK from v7.11.0 to v7.12.0 ([#2173](https://github.com/getsentry/sentry-dart/pull/2173))
72+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7120)
73+
- [diff](https://github.com/getsentry/sentry-java/compare/7.11.0...7.12.0)
74+
- updates AGP to v7.4.2
75+
- updates Kotlin to v1.8.0
76+
- Bump Cocoa SDK from v8.30.1 to v8.32.0 ([#2174](https://github.com/getsentry/sentry-dart/pull/2174), [#2195](https://github.com/getsentry/sentry-dart/pull/2195))
77+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8320)
78+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.30.1...8.32.0)
879

980
## 8.4.0
1081

dart/lib/sentry.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export 'src/sentry_baggage.dart';
4040
export 'src/exception_cause_extractor.dart';
4141
export 'src/exception_cause.dart';
4242
export 'src/exception_stacktrace_extractor.dart';
43+
export 'src/exception_type_identifier.dart';
4344
// URL
4445
// ignore: invalid_export_of_internal_element
4546
export 'src/utils/http_sanitizer.dart';
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:http/http.dart' show ClientException;
2+
import 'dart:async' show TimeoutException, AsyncError, DeferredLoadException;
3+
import '../sentry.dart';
4+
5+
import 'dart_exception_type_identifier_io.dart'
6+
if (dart.library.html) 'dart_exception_type_identifier_web.dart';
7+
8+
class DartExceptionTypeIdentifier implements ExceptionTypeIdentifier {
9+
@override
10+
String? identifyType(dynamic throwable) {
11+
// dart:core
12+
if (throwable is ArgumentError) return 'ArgumentError';
13+
if (throwable is AssertionError) return 'AssertionError';
14+
if (throwable is ConcurrentModificationError) {
15+
return 'ConcurrentModificationError';
16+
}
17+
if (throwable is FormatException) return 'FormatException';
18+
if (throwable is IndexError) return 'IndexError';
19+
if (throwable is NoSuchMethodError) return 'NoSuchMethodError';
20+
if (throwable is OutOfMemoryError) return 'OutOfMemoryError';
21+
if (throwable is RangeError) return 'RangeError';
22+
if (throwable is StackOverflowError) return 'StackOverflowError';
23+
if (throwable is StateError) return 'StateError';
24+
if (throwable is TypeError) return 'TypeError';
25+
if (throwable is UnimplementedError) return 'UnimplementedError';
26+
if (throwable is UnsupportedError) return 'UnsupportedError';
27+
// not adding Exception or Error because it's too generic
28+
29+
// dart:async
30+
if (throwable is TimeoutException) return 'TimeoutException';
31+
if (throwable is AsyncError) return 'FutureTimeout';
32+
if (throwable is DeferredLoadException) return 'DeferredLoadException';
33+
// not adding ParallelWaitError because it's not supported in dart 2.17.0
34+
35+
// dart http package
36+
if (throwable is ClientException) return 'ClientException';
37+
38+
// platform specific exceptions
39+
return identifyPlatformSpecificException(throwable);
40+
}
41+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'dart:io';
2+
3+
import 'package:meta/meta.dart';
4+
5+
@internal
6+
String? identifyPlatformSpecificException(dynamic throwable) {
7+
if (throwable is FileSystemException) return 'FileSystemException';
8+
if (throwable is HttpException) return 'HttpException';
9+
if (throwable is SocketException) return 'SocketException';
10+
if (throwable is HandshakeException) return 'HandshakeException';
11+
if (throwable is CertificateException) return 'CertificateException';
12+
if (throwable is TlsException) return 'TlsException';
13+
return null;
14+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:meta/meta.dart';
2+
3+
@internal
4+
String? identifyPlatformSpecificException(dynamic throwable) {
5+
return null;
6+
}

dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class WebEnricherEventProcessor implements EnricherEventProcessor {
7171

7272
int? _getMemorySize() {
7373
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory
74+
// ignore: invalid_null_aware_operator
7475
final size = _window.navigator.deviceMemory?.toDouble();
7576
final memoryByteSize = size != null ? size * 1024 * 1024 * 1024 : null;
7677
return memoryByteSize?.toInt();
@@ -102,5 +103,6 @@ class WebEnricherEventProcessor implements EnricherEventProcessor {
102103
}
103104

104105
extension on web.Navigator {
106+
// ignore: unused_element
105107
external double? get deviceMemory;
106108
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import 'package:meta/meta.dart';
2+
3+
/// An abstract class for identifying the type of Dart errors and exceptions.
4+
///
5+
/// It's used in scenarios where error types need to be determined in obfuscated builds
6+
/// as [runtimeType] is not reliable in such cases.
7+
///
8+
/// Implement this class to create custom error type identifiers for errors or exceptions.
9+
/// that we do not support out of the box.
10+
///
11+
/// Example:
12+
/// ```dart
13+
/// class MyExceptionTypeIdentifier implements ExceptionTypeIdentifier {
14+
/// @override
15+
/// String? identifyType(dynamic throwable) {
16+
/// if (throwable is MyCustomError) return 'MyCustomError';
17+
/// return null;
18+
/// }
19+
/// }
20+
/// ```
21+
abstract class ExceptionTypeIdentifier {
22+
String? identifyType(dynamic throwable);
23+
}
24+
25+
extension CacheableExceptionIdentifier on ExceptionTypeIdentifier {
26+
ExceptionTypeIdentifier withCache() => CachingExceptionTypeIdentifier(this);
27+
}
28+
29+
@visibleForTesting
30+
class CachingExceptionTypeIdentifier implements ExceptionTypeIdentifier {
31+
@visibleForTesting
32+
ExceptionTypeIdentifier get identifier => _identifier;
33+
final ExceptionTypeIdentifier _identifier;
34+
35+
final Map<Type, String?> _knownExceptionTypes = {};
36+
37+
CachingExceptionTypeIdentifier(this._identifier);
38+
39+
@override
40+
String? identifyType(dynamic throwable) {
41+
final runtimeType = throwable.runtimeType;
42+
if (_knownExceptionTypes.containsKey(runtimeType)) {
43+
return _knownExceptionTypes[runtimeType];
44+
}
45+
46+
final identifiedType = _identifier.identifyType(throwable);
47+
48+
if (identifiedType != null) {
49+
_knownExceptionTypes[runtimeType] = identifiedType;
50+
}
51+
52+
return identifiedType;
53+
}
54+
}

0 commit comments

Comments
 (0)