JamesBarwell / rpi-gpio.js

Control Raspberry Pi GPIO pins with node.js
MIT License
657 stars 116 forks source link

gpio.setup error is not correctly caught by Promise #91

Closed dawn-minion closed 5 years ago

dawn-minion commented 5 years ago

If the regex match fails on rpi-gpio.js:365, the next line that attempts access match[1] will fail and throw a TypeError that is not caught by the Promise. Instead of .catch being called and handling this in my promise, the program will die.

JamesBarwell commented 5 years ago

Thanks for reporting this and for the PR.

Out of interest, did you come across this using real Raspberry Pi hardware? Is there also an issue with the regex?

Edit: ah, just saw your comment on the PR. Nevermind. Thanks.

dawn-minion commented 5 years ago

@JamesBarwell Ah sorry, should have said here. Regex does seem fine, I just liked developing locally as it's quicker than on the Pi =)