diff --git a/lib/pangea/models/representation_content_model.dart b/lib/pangea/models/representation_content_model.dart index dc81f191e8..c4ff52fe75 100644 --- a/lib/pangea/models/representation_content_model.dart +++ b/lib/pangea/models/representation_content_model.dart @@ -2,6 +2,7 @@ import 'package:fluffychat/pangea/constants/language_keys.dart'; import 'package:fluffychat/pangea/models/speech_to_text_models.dart'; import 'package:fluffychat/pangea/utils/error_handler.dart'; import 'package:matrix/matrix.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; /// this class is contained within a [RepresentationEvent] /// this event is the child of a [EventTypes.Message] @@ -60,6 +61,7 @@ class PangeaRepresentation { e: Exception("Language code cannot be 'unk'"), s: StackTrace.current, data: {"rep_content": json}, + level: SentryLevel.warning, ); } return PangeaRepresentation( diff --git a/lib/pangea/utils/error_handler.dart b/lib/pangea/utils/error_handler.dart index b75efb74cc..d66c29186c 100644 --- a/lib/pangea/utils/error_handler.dart +++ b/lib/pangea/utils/error_handler.dart @@ -12,25 +12,6 @@ class ErrorHandler { ErrorHandler(); static Future initialize() async { - FutureOr Function(Scope)? withScope( - Scope scope, - FlutterErrorDetails details, - ) { - // if (details.exception is http.Response) { - // final res = details.exception as http.Response; - // scope.addBreadcrumb( - // Breadcrumb.http( - // url: res.request?.url ?? Uri(path: "not available"), - // method: "where does method go?", - // statusCode: res.statusCode, - // ), - // ); - // } else { - // debugPrint("not an http exception ${details.exception.toString()}"); - // } - return null; - } - await SentryFlutter.init( (options) { options.dsn = Environment.sentryDsn; @@ -41,10 +22,6 @@ class ErrorHandler { : Environment.isStaging ? "staging" : "productionC"; - // options.beforeSend = (event, {hint}) { - // debugger(when: kDebugMode); - // return null; - // }; }, ); @@ -54,7 +31,6 @@ class ErrorHandler { Sentry.captureException( details.exception, stackTrace: details.stack ?? StackTrace.current, - withScope: (scope) => withScope(scope, details), ); } }; @@ -70,6 +46,7 @@ class ErrorHandler { StackTrace? s, String? m, Map? data, + SentryLevel level = SentryLevel.error, }) async { if (m != null) debugPrint("error message: $m"); if ((e ?? m) != null) debugPrint("error to string: ${e?.toString() ?? m}"); @@ -77,19 +54,13 @@ class ErrorHandler { Sentry.addBreadcrumb(Breadcrumb.fromJson(data)); debugPrint(data.toString()); } - FlutterError.reportError( - FlutterErrorDetails( - exception: e ?? Exception(m ?? "no message supplied"), - stack: s, - library: 'Pangea', - context: ErrorSummary(e?.toString() ?? "error not defined"), - stackFilter: (input) => input.where( - (e) => !(e.contains("org-dartlang-sdk") || - e.contains("future_impl") || - e.contains("microtask") || - e.contains("async_patch")), - ), - ), + + Sentry.captureException( + e ?? Exception(m ?? "no message supplied"), + stackTrace: s ?? StackTrace.current, + withScope: (scope) { + scope.level = level; + }, ); } } diff --git a/pubspec.yaml b/pubspec.yaml index fbb9c0d7bd..3a60f60a82 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -118,7 +118,7 @@ dependencies: material_symbols_icons: ^4.2741.0 open_file: ^3.3.2 purchases_flutter: ^6.26.0 - sentry_flutter: ^7.19.0 + sentry_flutter: ^8.2.0 shimmer: ^3.0.0 syncfusion_flutter_xlsio: ^25.1.40 # Pangea#