Closed RichardsonWTR closed 8 years ago
They should be an exception thrown :
https://github.com/edi9999/jsqrcode/blob/master/src/alignpat.js#L276
Sorry my insistence, but I have not explained well :/ The message I get is inside the callback! See some samples:
error decoding QR Code: Couldn't find enough finder patterns:0 patterns found
error decoding QR Code: Couldn't find enough finder patterns:1 patterns found
error decoding QR Code: Couldn't find enough finder patterns:2 patterns found
error decoding QR Code: Error locator degree does not match number of roots
error decoding QR Code: Invalid mode: 6 in (block:0 bit:3)
But, when I adjust the image on camera correctly, the callback gets the message of the code correctly.
I have investigated the decode
method and I think there is a small change to do. This line
this.result = "error decoding QR Code: " + e;
should be
throw "error decoding QR Code: " + e;
See here! https://github.com/edi9999/jsqrcode/blob/master/src/qrcode.js#L37
Indeed, this seems to be a problem.
The problem I think was that since the execution is async, we can't just throw here, but we have to pass the error to the callback.
I don't have much time to do this, maybe you can do a Pull request ?
Sorry for the delay to reply! Take a look! #21
When the image is not good enough, I get the message:
"error decoding QR Code: Couldn't find enough finder patterns"
But I am detecting the QR code inside a loop. In the LazarSoft code, when the QR code is not good enough, a exception is thrown.
How I will know when failed to read?