SDK Error Messages
All errors raised by the SDK are instances of the SdkError class. An SdkError contains an error message and an optional detail message, which can be helpful in determining the cause of the error.
SDK Initialization Errors
The table below lists the most common errors that may occur when initializing the SDK using the StrichSDK.initialize() method.
SdkError | Description |
---|---|
message: The license key is invalid or expired. Please obtain a new one. detailMessage: Invalid license: state is deleted |
The license key used by your app was deleted in the Customer Portal. A deleted license key can not reactivated. You will have to replace it with an active one. |
message: The license key is invalid or expired. Please obtain a new one. detailMessage: Invalid license: state is expired |
The license key has expired, most likely because you canceled your subscription. An expired license keys can not be reactivated. You will have to replace it with an active one. |
message: The license key is invalid or expired. Please obtain a new one. detailMessage: Invalid license: location https://app.example.com not in scope of license 228ffc90-aa54-405e-8be8-df6ca2f8a265 |
The license key does not contain the URL from which your app is served. Make sure you are using the correct license key in your app, and that it contains the URL from where your app is being served. You can inspect your license keys in the Customer Portal. If you can't find your license key, you might have deleted it, or it might have been cleared when your subscription was canceled. |
message: The license key could not be checked. An internet connection is required. detailMessage: fetch failed after 2 retries |
The one license key check failed, probably due to a network error. Make sure that the URL https://license.strich.io can be reached by your app. Refer to the Deployment Guide for more information on this topic. Offline license checking is available as an add-on in the Enterprise plan, contact sales@pixelverse.ch for more details. |
message: The license key is invalid or expired. Please obtain a new one. detailMessage: <empty> |
The license key might be malformed due to a typo, additional/unwanted characters inserted by a word processor, or a copy & paste error. Check that the license key is correct, and use the Copy to Clipboard function in the Customer Portal. |
BarcodeReader Errors
The table below lists the most common errors that may occur while setting up a BarcodeReader.
Setting up a BarcodeReader is a two-step process: first a new instance is created using the constructor, and a Configuration is passed. Then the BarcodeReader is initialized (at this stage, the camera device is accessed).
BarcodeReader Constructor Errors
Errors during the constructor are typically due to issues with the Configuration that was passed:
SdkError | Description |
---|---|
message: The supplied configuration is not valid detailMessage: Invalid host element, use selector matching single element or the element itself |
If a string is passed as selector, the selector did not match an element in the DOM. If an element was passed, the element was not valid (not a container, or a null or undefined value). |
message: The supplied configuration is not valid detailMessage: Host element must use position: relative |
The selector in the Configuration refers to an element, but its CSS position attribute does not have the value ‘relative’. |
message: The supplied configuration is not valid detailMessage: Host element has zero width or height |
The selector refers to an element which has zero size (height and/or width). In Component-centric frameworks like Angular, React, etc. this is often happens when the BarcodeReader is initialized too early in the host component's lifecycle, e.g. for Angular ngAfterViewInit() instead of ngOnInit() needs to be used, because in the latter callback, the host element may not yet exist in the DOM. |
message: Your browser is not supported. Please use an up-to-date browser. detailMessage: WebAssembly not supported or: detailMessage: WebRTC/getUserMedia not supported or: detailMessage: WebGL not supported |
The web browser in which the app is running is not recent enough, or lacks a key feature that the library requires. STRICH requires the following capabilities, which are widely available:
|
BarcodeReader Initialization Errors
Errors occurring in the initialize() method are often related to camera access.
SdkError | Description |
---|---|
message: Camera access is not permitted, please review website permissions and retry. | Access to the camera requires the user’s permission. In this case, the user did not grant permission. Especially on Safari (iOS), the permission, once granted, is frequently “forgotten” by the browser, and has to be granted again by the user. |
message: Unable to open camera. Make sure no other app or browser tab is using the camera. | The camera is a shared resource that needs to be closed by the app that is using it before the next app can use it. This error signals that the camera was “busy” when the library tried to access it. Often the camera is being held by some other browser tab or app that needs to relinquish it first. |
message: Camera access failed, camera device is not compatible. | The detected camera device is not suitable for barcode scanning. This should be a rare occurrence on smartphones. |
message: No suitable camera device was found. |
The library did not detect a suitable camera device for barcode scanning. To handle this scenario proactively, e.g. by showing a friendly hint in the app, we provide a utility method StrichSDK.hasCameraDevice(). |
Phew. That's a lot of errors! If you encounter one not on this list, please let us know and we'll update the documentation ASAP.