1. React Native
  2. Error Reporting

React Native

Error Reporting

You can report problems encountered during on-device OCR extraction using built-in reporting functions. These reports are sent automatically if the device has an internet connection. If not, the SDK will store the report and post it once connectivity is restored.


๐Ÿงพ Reporting an Issue Manually

To report an issue manually from the on-device OCR process, use the following imperative method:

                visionSdk.current?.reportError({
          reportText: 'respose is not correct',
          type: 'item_label', // this is the documen type, [item_label, shipping_label, bill_of_lading, document_classification]
          size: 'large', // this is the model size
          response: {}, // any valid json
          image: '', // the image on which reporting errors
          errorFlags: { // granular fields showing which fields have error, error flags object is different for each document type
            supplierName: true,
            itemName: false,
            itemSKU: true,
            weight: true,
            quantity: true,
            dimensions: true,
            productionDate: false,
            supplierAddress: true
          }
        },
         "",  //this is the token
         apiKey // this is the apiKey, either token or apikey should be defined
         )

      

๐Ÿ” Parameters:

  • apiKey / token: Required for authentication. Either one must be provided.
  • type: The model type where the error occurred (e.g., shipping_label, item_label, bill_of_lading).
  • modelSize: The size of the model being used. Supported sizes: micro, large.
  • image: (Optional) The image that was used during the scan, passed as a CIImage.
  • reportText: A clear description of the issue you're facing.
  • response: (Optional) The response object (if any) received from the on-device scan.
  • errorFlags: (Optional) A custom object to provide structured metadata about the report.

This method should be called using the ref instance:

Example for Shipping Label error report

                visionSdk.current?.reportError({
          reportText: 'respose is not correct',
          type: 'item_label', // this is the document type, [item_label, shipping_label, bill_of_lading, document_classification]
          size: 'large', // this is the model size
          response: {}, // any valid json
          image: '', // the image on which reporting errors
          errorFlags: { // granular fields showing which fields have error, error flags object is different for each document type
            trackingNo: true,
            courierName: false,
            weight: true,
            dimensions: false,
            receiverName: true,
            receiverAddress: true,
            senderName: false,
            senderAddres: false
          }
        },
         "",  //this is the token
         apiKey // this is the apiKey, either token or apikey should be defined
         )

      

Example for Item Label error report

                visionSdk.current?.reportError({
          reportText: 'respose is not correct',
          type: 'item_label', // this is the document type, [item_label, shipping_label, bill_of_lading, document_classification]
          size: 'large', // this is the model size
          response: {}, // any valid json
          image: '', // the image on which reporting errors
          errorFlags: { // granular fields showing which fields have error, error flags object is different for each document type
            supplierName: true,
            itemName: false,
            itemSKU: true,
            weight: true,
            quantity: true,
            dimensions: true,
            productionDate: false,
            supplierAddress: true
          }
        },
         "",  //this is the token
         apiKey // this is the apiKey, either token or apikey should be defined
         )

      

Example for Bill of Lading error report

                visionSdk.current?.reportError({
          reportText: 'respose is not correct',
          type: 'item_label', // this is the document type, [item_label, shipping_label, bill_of_lading, document_classification]
          size: 'large', // this is the model size
          response: {}, // any valid json
          image: '', // the image on which reporting errors
          errorFlags: { // granular fields showing which fields have error, error flags object is different for each document type
            referenceNo: true,
            loadNumber: false,
            purchaseOrderNumber: true,
            invoiceNumber: true,
            customerPurchaseOrderNumber: false,
            orderNumber: true,
            billOfLading: false,
            masterBillOfLading: false,
            lineBillOfLading: false,
            houseBillOfLading: true,
            shippingId: false,
            shippingDate: true,
            date: false
          }
        },
         "",  //this is the token
         apiKey // this is the apiKey, either token or apikey should be defined
         )

      

Example for Document Classification error report

                visionSdk.current?.reportError({
          reportText: 'respose is not correct',
          type: 'item_label', // this is the document type, [item_label, shipping_label, bill_of_lading, document_classification]
          size: 'large', // this is the model size
          response: {}, // any valid json
          image: '', // the image on which reporting errors
          errorFlags: { // granular fields showing which fields have error, error flags object is different for each document type
            documentClass: true
          }
        },
         "",  //this is the token
         apiKey // this is the apiKey, either token or apikey should be defined
         )