From 9c8edaada8d175d72076686bb3d890a1361ef4f2 Mon Sep 17 00:00:00 2001 From: wcjord <32568597+wcjord@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:07:50 -0500 Subject: [PATCH] adding data error handler call --- lib/main.dart | 2 +- lib/pages/chat/chat.dart | 61 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 847b012b2..9f5e656bd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,7 +23,7 @@ void main() async { // #Pangea try { - await dotenv.load(fileName: ".env.local_choreo"); + await dotenv.load(fileName: ".env"); } catch (e) { Logs().e('Failed to load .env file', e); } diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index a4c57ae11..f7ec1c96f 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -519,7 +519,10 @@ class ChatController extends State ErrorHandler.logError( e: PangeaWarningError("Failed to set read marker: $e"), s: s, - m: 'Failed to set read marker for eventId: $eventId', + data: { + 'eventId': eventId, + 'roomId': roomId, + }, ); Sentry.captureException( e, @@ -689,11 +692,26 @@ class ChatController extends State ErrorHandler.logError( e: Exception('msgEventId is null'), s: StackTrace.current, + data: { + 'roomId': roomId, + 'text': sendController.text, + 'inReplyTo': replyEvent?.eventId, + 'editEventId': editEvent?.eventId, + }, ); return; } }, - onError: (err, stack) => ErrorHandler.logError(e: err, s: stack), + onError: (err, stack) => ErrorHandler.logError( + e: err, + s: stack, + data: { + 'roomId': roomId, + 'text': sendController.text, + 'inReplyTo': replyEvent?.eventId, + 'editEventId': editEvent?.eventId, + }, + ), ); // Pangea# sendController.value = TextEditingValue( @@ -834,7 +852,16 @@ class ChatController extends State // #Pangea // ).catchError((e) { ).catchError((e, s) { - ErrorHandler.logError(e: e, s: s); + ErrorHandler.logError( + e: e, + s: s, + data: { + 'roomId': roomId, + 'file': file.name, + 'duration': result.duration, + 'waveform': result.waveform, + }, + ); // Pangea# scaffoldMessenger.showSnackBar( SnackBar( @@ -964,7 +991,16 @@ class ChatController extends State event.content['body'].toString(), ); } catch (err) { - ErrorHandler.logError(e: err, s: StackTrace.current); + ErrorHandler.logError( + e: err, + s: StackTrace.current, + data: { + 'roomId': roomId, + 'reason': reason.single, + 'senderId': event.senderId, + 'content': event.content['body'].toString(), + }, + ); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( @@ -1127,7 +1163,10 @@ class ChatController extends State void sendAgainAction() { // #Pangea if (selectedEvents.isEmpty) { - ErrorHandler.logError(e: "No selected events in send again action"); + ErrorHandler.logError( + e: "No selected events in send again action", + s: StackTrace.current, + data: {"roomId": roomId}); clearSelectedEvents(); return; } @@ -1658,7 +1697,17 @@ class ChatController extends State ); } catch (err) { debugger(when: kDebugMode); - ErrorHandler.logError(e: err, s: StackTrace.current); + ErrorHandler.logError( + e: err, + s: StackTrace.current, + data: { + 'roomId': roomId, + 'event': event.toJson(), + 'selectedToken': selectedToken?.toJson(), + 'nextEvent': nextEvent?.toJson(), + 'prevEvent': prevEvent?.toJson(), + }, + ); return; }