JamesBarwell / rpi-gpio.js

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

#91 Add catch for failed /proc/cpuinfo parsing in setup() #92

Closed dawn-minion closed 5 years ago

dawn-minion commented 5 years ago

Adds a check that the regex on /proc/cpuinfo actually matches correctly, and rejects the promise if not. I've added a small unit test that passes "A Bad Revision" to getCpuInfo and verifies catch is indeed called on the promise. Not sure if this is how you'd want to test this, but, it does verify the error is correctly caught by the Promise returned.

This really only happened when running on something not a Pi, but, was a bit inconvenient when wanting to test local changes on my laptop as it crashes the whole program vs the Promise handling it as I expected.

Fixes #91

JamesBarwell commented 5 years ago

Published in v2.1.2. Cheers.

dawn-minion commented 5 years ago

Thanks!