mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Improve barcode error handling
This commit is contained in:
parent
e2ed80f2d0
commit
6d764e32a0
@ -332,10 +332,6 @@ class InvenTreeAPI {
|
||||
if (!address.endsWith("/")) {
|
||||
address = address + "/";
|
||||
}
|
||||
/* TODO: Better URL validation
|
||||
* - If not a valid URL, return error
|
||||
* - If no port supplied, append a default port
|
||||
*/
|
||||
|
||||
_BASE_URL = address;
|
||||
|
||||
|
@ -77,7 +77,7 @@ class BarcodeHandler {
|
||||
body: {
|
||||
"barcode": barcode,
|
||||
},
|
||||
expectedStatusCode: 200
|
||||
expectedStatusCode: null, // Do not show an error on "unexpected code"
|
||||
);
|
||||
|
||||
_controller?.resumeCamera();
|
||||
@ -90,7 +90,7 @@ class BarcodeHandler {
|
||||
|
||||
// We want to know about this one!
|
||||
await sentryReportMessage(
|
||||
"BarcodeHandler.processBarcode returned strange value",
|
||||
"BarcodeHandler.processBarcode returned unexpected value",
|
||||
context: {
|
||||
"data": response.data?.toString() ?? "null",
|
||||
"barcode": barcode,
|
||||
@ -102,7 +102,7 @@ class BarcodeHandler {
|
||||
"overlayText": getOverlayText(context),
|
||||
}
|
||||
);
|
||||
} else if (data.containsKey("error")) {
|
||||
} else if ((response.statusCode >= 400) || data.containsKey("error")) {
|
||||
onBarcodeUnknown(context, data);
|
||||
} else if (data.containsKey("success")) {
|
||||
onBarcodeMatched(context, data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user