How to use the @zxing/library.Exception.ChecksumException function in @zxing/library

To help you get started, we’ve selected a few @zxing/library examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zxing-js / ngx-scanner / src / app / modules / ngx-zxing / browser-code-reader.ts View on Github external
if (!once && !!this.stream) {
                setTimeout(() => this.decodeWithDelay(callbackFn), this.timeBetweenScansMillis);
            }
        } catch (re) {

            console.log(retryIfChecksumOrFormatError, re);

            if (retryIfNotFound && Exception.isOfType(re, Exception.NotFoundException)) {
                console.warn('Not found, trying again...');

                this.decodeWithDelay(callbackFn);
            } else if (
                retryIfChecksumOrFormatError &&
                (
                    Exception.isOfType(re, Exception.ChecksumException) ||
                    Exception.isOfType(re, Exception.FormatException)
                )
            ) {
                console.log('Checksum or format error, trying again...', re);

                this.decodeWithDelay(callbackFn);
            }
        }
    }