adding data error handler call

This commit is contained in:
wcjord 2024-12-20 10:07:50 -05:00
parent ccf19aa8a4
commit 9c8edaada8
2 changed files with 56 additions and 7 deletions

View file

@ -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);
}

View file

@ -519,7 +519,10 @@ class ChatController extends State<ChatPageWithRoom>
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<ChatPageWithRoom>
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<ChatPageWithRoom>
// #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<ChatPageWithRoom>
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<ChatPageWithRoom>
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<ChatPageWithRoom>
);
} 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;
}