diff --git a/lib/api.dart b/lib/api.dart index 51a414c3..e69f7564 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -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; diff --git a/lib/barcode.dart b/lib/barcode.dart index af16658a..8781f2d1 100644 --- a/lib/barcode.dart +++ b/lib/barcode.dart @@ -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);