From 2a5bb4631b1efaf7ba03dd29435c93e8c3cbbe3f Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 15 Jul 2021 09:46:09 +1000 Subject: [PATCH] Report message to sentry in case of bad JSON decoding --- lib/api.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/api.dart b/lib/api.dart index edb4a279..30abfefd 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -349,8 +349,6 @@ class InvenTreeAPI { // Load selected profile profile = await UserProfileDBManager().getSelectedProfile(); - print("API Profile: ${profile.toString()}"); - if (profile == null) { showSnackIcon( L10().profileSelect, @@ -364,8 +362,6 @@ class InvenTreeAPI { _connected = await _connect(); - print("_connect() returned result: ${_connected}"); - _connecting = false; if (_connected) { @@ -747,8 +743,6 @@ class InvenTreeAPI { ); return false; } - - return allowBadCert; }); // Set the connection timeout @@ -857,6 +851,15 @@ class InvenTreeAPI { print("JSON format exception!"); print("${body}"); + sentryReportMessage( + "Error decoding JSON response from server", + context: { + "headers": response.headers.toString(), + "statusCode": response.statusCode.toString(), + "data": body.toString(), + } + ); + showServerError( L10().formatException, L10().formatExceptionJson + ":\n${body}"