Describe the bug
scanFailure event is being triggered constantly with Angular 8.
The stack trace is this:
No MultiFormat Readers were able to detect the code.
at l.decodeInternal (https://angular-usl95g.stackblitz.io/turbo_modules/@zxing/[email protected]/umd/index.min.js:1:124857)
at l.decodeWithState (https://angular-usl95g.stackblitz.io/turbo_modules/@zxing/[email protected]/umd/index.min.js:1:123702)
at BrowserMultiFormatContinuousReader.f.decodeBitmap (https://angular-usl95g.stackblitz.io/turbo_modules/@zxing/[email protected]/umd/index.min.js:1:166444)
at BrowserMultiFormatContinuousReader.p.decode (https://angular-usl95g.stackblitz.io/turbo_modules/@zxing/[email protected]/umd/index.min.js:1:31153)
at BrowserMultiFormatContinuousReader.decodeOnSubject (https://angular-usl95g.stackblitz.io/turbo_modules/@zxing/[email protected]/bundles/zxing-ngx-scanner.umd.js:560:35)
at eval (https://angular-usl95g.stackblitz.io/turbo_modules/@zxing/[email protected]/bundles/zxing-ngx-scanner.umd.js:580:59)
at ZoneDelegate.invokeTask (https://angular-usl95g.stackblitz.io/turbo_modules/[email protected]/dist/zone.js:423:31)
at Object.onInvokeTask (https://angular-usl95g.stackblitz.io/turbo_modules/@angular/[email protected]/bundles/core.umd.js:24385:37)
at ZoneDelegate.invokeTask (https://angular-usl95g.stackblitz.io/turbo_modules/[email protected]/dist/zone.js:422:60)
at Zone.runTask (https://angular-usl95g.stackblitz.io/turbo_modules/[email protected]/dist/zone.js:195:47)
To Reproduce
I have an app in StackBlitz that demonstrates the problem:
https://angular-usl95g.stackblitz.io
Basically, you just need to add this on an Angular 8 app:
<zxing-scanner
class="fit-video"
[enable]="true"
(scanFailure)="handleFailure($event)"
></zxing-scanner>
with this event handler:
handleFailure(e) {
console.log(e);
}
And then you get flooded in errors.
In our application, we're disabling the scan flow if the scanner emits an error, so it's a blocker for us, preventing us from upgrading to Angular 8.
Expected behavior
There should not be any failures being logged.
Desktop (please complete the following information):
No MultiFormat Readers were able to detect the code.
This is not an error, this is a failure to decode a barcode in the current image stream, it means it is expected.
If you wanna look for unexpected errors that may cause the scanner to not work anymore, go with scanError.
Thanks.
Thank you @odahcam , apologies for the misunderstanding. We'll change the handler to scanError as you mentioned.
No problem, feel free to open new issues as you need.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
This is not an error, this is a failure to decode a barcode in the current image stream, it means it is expected.
If you wanna look for unexpected errors that may cause the scanner to not work anymore, go with
scanError.Thanks.