mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 09:06:43 +08:00
Log some exceptions are warnings
These aren't really a problem, but it's still interesting to know if they are happening.
This commit is contained in:
@ -117,7 +117,7 @@ class NotesCache {
|
||||
return json.decode(contents).cast<String>();
|
||||
} catch (ex, st) {
|
||||
Log.e("Exception - $ex for contents: $contents");
|
||||
await logException(ex, st);
|
||||
await logExceptionWarning(ex, st);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,15 @@ Future<void> logException(Exception e, StackTrace stackTrace) async {
|
||||
return FlutterCrashlytics().logException(e, stackTrace);
|
||||
}
|
||||
|
||||
Future<void> logExceptionWarning(Exception e, StackTrace stackTrace) async {
|
||||
if (!reportCrashes) {
|
||||
return;
|
||||
}
|
||||
|
||||
await captureSentryException(e, stackTrace, level: SeverityLevel.warning);
|
||||
return FlutterCrashlytics().logException(e, stackTrace);
|
||||
}
|
||||
|
||||
List<Breadcrumb> breadcrumbs = [];
|
||||
|
||||
void captureErrorBreadcrumb({
|
||||
@ -121,14 +130,16 @@ void captureErrorBreadcrumb({
|
||||
|
||||
Future<void> captureSentryException(
|
||||
Object exception,
|
||||
StackTrace stackTrace,
|
||||
) async {
|
||||
StackTrace stackTrace, {
|
||||
SeverityLevel level = SeverityLevel.error,
|
||||
}) async {
|
||||
try {
|
||||
final sentry = await getSentryClient();
|
||||
final Event event = Event(
|
||||
exception: exception,
|
||||
stackTrace: stackTrace,
|
||||
breadcrumbs: breadcrumbs,
|
||||
level: level,
|
||||
);
|
||||
|
||||
return sentry.capture(event: event);
|
||||
|
Reference in New Issue
Block a user