-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Error handling in ScanCaps.ts for printers without ADF #805
Add Error handling in ScanCaps.ts for printers without ADF #805
Conversation
Catches the TypeError that is thrown when a printer without an ADF feature is queried for capabilities. The printer returns nothing under the "ADF" header, which crashes the application. Error handling returns null if this situation is caught.
I should have put this in the commit description but this is an issue that I ran into using an HP ENVY PHOTO 6255. Please let me know if I can improve the style or approach in this code. I am not very familiar with node or JS in general. Cheers |
Hi @ibrummel thanks for submitting this pr and sorry for the regression Could you provide the payload sample that is causing the issue so that we can try to implement the fix without relying on Exception catch control flow |
Hi @manuc66, Best I can tell this issue is coming up because my printer returns information that just doesn't include an ADF block in the XML. The returned XML is here:
The parsed version before createScanCaps returns to the constructor looks like this, without an ADF block:
When I was originally looking at the code, I thought the structure of the return statement in
Please let me know if I can help out with any other info, and sorry about going to exception catching, I come from the land of hobbyist Python where that seems to be pretty widely accepted practice. |
Catches the TypeError that is thrown when a printer without an ADF feature is queried for capabilities. The printer returns nothing under the "ADF" header, which crashes the application. Error handling returns null if this situation is caught.