caobo171 / node-zklib

This is a lightweight of node.js module to connect to biometrix attendance device for examples ZKTeco
70 stars 59 forks source link

Adding error handling to readWithBuffer function #32

Open AndreHrs opened 2 years ago

AndreHrs commented 2 years ago

When machine does not have logs data stored (Mine was ZKTeco K20), This library will cease to function (not throwing exception and just failed) The original code tried to decode header which was empty or trying to access commandId from empty object

I just added exception handling to readWithBuffer function so it will reject the promise and does not stop the whole code from running.

-- Additional Comment -- Also, sorry for the lint I forgot to disable the lint on save function.