mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Improve error handling and reporting (#190)
* Prevent duplicate reporting of errors to sentry * Prevent error message upload on some server error codes * Filter out some common errors we are not interested in
This commit is contained in:
parent
75e0a69eab
commit
dacbf880da
3 changed files with 51 additions and 12 deletions
|
|
@ -145,6 +145,9 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Report an error message to sentry.io
|
||||
*/
|
||||
Future<void> sentryReportError(String source, dynamic error, dynamic stackTrace, {Map<String, String> context = const {}}) async {
|
||||
|
||||
print("----- Sentry Intercepted error: $error -----");
|
||||
|
|
@ -166,6 +169,22 @@ Future<void> sentryReportError(String source, dynamic error, dynamic stackTrace,
|
|||
return;
|
||||
}
|
||||
|
||||
// Some errors are outside our control, and we do not want to "pollute" the uploaded data
|
||||
if (source == "FlutterError.onError") {
|
||||
|
||||
String errorString = error.toString();
|
||||
|
||||
// Missing media file
|
||||
if (errorString.contains("HttpException") && errorString.contains("404") && errorString.contains("/media/")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Local file system exception
|
||||
if (errorString.contains("FileSystemException")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final server_info = getServerInfo();
|
||||
final app_info = await getAppInfo();
|
||||
final device_info = await getDeviceInfo();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue