Skip to content

Commit 346e26b

Browse files
committed
feat: enhance non-fatal exceptions control inside InstabugWidget
- Added `nonFatalExceptionLevel` property to `InstabugWidget` for better granularity in error reporting.
1 parent bf87836 commit 346e26b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/src/utils/instabug_widget.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ class InstabugWidget extends StatefulWidget {
5353
/// If true, the Flutter error will be reported as a non-fatal crash, instead of a fatal crash.
5454
final bool nonFatalFlutterErrors;
5555

56+
/// The level of the non-fatal exception.
57+
///
58+
/// This is used to determine the level of the non-fatal exception.
59+
///
60+
/// Note: This has no effect if [nonFatalFlutterErrors] is false.
61+
final NonFatalExceptionLevel nonFatalExceptionLevel;
62+
5663
/// Whether to exit the app on Flutter error.
5764
///
5865
/// If true, the app will exit when a Flutter error occurs.
@@ -77,6 +84,7 @@ class InstabugWidget extends StatefulWidget {
7784
this.flutterErrorHandler,
7885
this.platformErrorHandler,
7986
this.nonFatalFlutterErrors = false,
87+
this.nonFatalExceptionLevel = NonFatalExceptionLevel.error,
8088
this.shouldExitOnFlutterError = false,
8189
}) : super(key: key);
8290

@@ -109,6 +117,7 @@ class _InstabugWidgetState extends State<InstabugWidget> {
109117
CrashReporting.reportHandledCrash(
110118
details.exception,
111119
details.stack ?? StackTrace.current,
120+
level: widget.nonFatalExceptionLevel,
112121
);
113122
} else {
114123
CrashReporting.reportCrash(
@@ -123,7 +132,7 @@ class _InstabugWidgetState extends State<InstabugWidget> {
123132
exit(1);
124133
}
125134
};
126-
135+
127136
PlatformDispatcher.instance.onError = (Object error, StackTrace stack) {
128137
// Call user's custom handler if provided
129138
if (widget.platformErrorHandler != null) {

0 commit comments

Comments
 (0)