2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00

Report message to sentry in case of bad JSON decoding

This commit is contained in:
Oliver 2021-07-15 09:46:09 +10:00
parent aea0036881
commit 2a5bb4631b

View File

@ -349,8 +349,6 @@ class InvenTreeAPI {
// Load selected profile // Load selected profile
profile = await UserProfileDBManager().getSelectedProfile(); profile = await UserProfileDBManager().getSelectedProfile();
print("API Profile: ${profile.toString()}");
if (profile == null) { if (profile == null) {
showSnackIcon( showSnackIcon(
L10().profileSelect, L10().profileSelect,
@ -364,8 +362,6 @@ class InvenTreeAPI {
_connected = await _connect(); _connected = await _connect();
print("_connect() returned result: ${_connected}");
_connecting = false; _connecting = false;
if (_connected) { if (_connected) {
@ -747,8 +743,6 @@ class InvenTreeAPI {
); );
return false; return false;
} }
return allowBadCert;
}); });
// Set the connection timeout // Set the connection timeout
@ -857,6 +851,15 @@ class InvenTreeAPI {
print("JSON format exception!"); print("JSON format exception!");
print("${body}"); print("${body}");
sentryReportMessage(
"Error decoding JSON response from server",
context: {
"headers": response.headers.toString(),
"statusCode": response.statusCode.toString(),
"data": body.toString(),
}
);
showServerError( showServerError(
L10().formatException, L10().formatException,
L10().formatExceptionJson + ":\n${body}" L10().formatExceptionJson + ":\n${body}"