mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Report message to sentry in case of bad JSON decoding
This commit is contained in:
parent
aea0036881
commit
2a5bb4631b
15
lib/api.dart
15
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}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user