mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-18 09:22:47 +08:00
logException: Also log to Sentry
This commit is contained in:
@ -107,3 +107,21 @@ Future<void> reportError(Object error, StackTrace stackTrace) async {
|
||||
print("Uncaught Exception: $error");
|
||||
print(stackTrace);
|
||||
}
|
||||
|
||||
Future<void> logException(Exception e, StackTrace stackTrace) async {
|
||||
if (!reportCrashes) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final sentry = await getSentryClient();
|
||||
await sentry.captureException(
|
||||
exception: e,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
} catch (e) {
|
||||
print("Failed to report with Sentry: $e");
|
||||
}
|
||||
|
||||
return FlutterCrashlytics().logException(e, stackTrace);
|
||||
}
|
||||
|
Reference in New Issue
Block a user