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