mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-17 04:35:26 +00:00
Add extra context information to sentry error reports
- Should help to track down bugs where stacktrace is missing information - Adds some more error catching, too
This commit is contained in:
@ -142,7 +142,7 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
|
||||
}
|
||||
|
||||
|
||||
Future<void> sentryReportError(dynamic error, dynamic stackTrace) async {
|
||||
Future<void> sentryReportError(String source, dynamic error, dynamic stackTrace, {Map<String, String> context = const {}}) async {
|
||||
|
||||
print("----- Sentry Intercepted error: $error -----");
|
||||
print(stackTrace);
|
||||
@ -167,10 +167,14 @@ Future<void> sentryReportError(dynamic error, dynamic stackTrace) async {
|
||||
final app_info = await getAppInfo();
|
||||
final device_info = await getDeviceInfo();
|
||||
|
||||
// Ensure we pass the 'source' of the error
|
||||
context["source"] = source;
|
||||
|
||||
Sentry.configureScope((scope) {
|
||||
scope.setExtra("server", server_info);
|
||||
scope.setExtra("app", app_info);
|
||||
scope.setExtra("device", device_info);
|
||||
scope.setExtra("context", context);
|
||||
});
|
||||
|
||||
Sentry.captureException(error, stackTrace: stackTrace).catchError((error) {
|
||||
|
Reference in New Issue
Block a user