Skip to content

Commit 08ce223

Browse files
author
Blaine Schmeisser
committed
Close the button when you can no longer write.
1 parent 0b1f73a commit 08ce223

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

BigRedButton.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ function BigRedButton(index)
5555
util.inherits(BigRedButton, events.EventEmitter);
5656

5757
BigRedButton.prototype.askForStatus = function() {
58-
this.hid.write(cmdStatus);
58+
try {
59+
this.hid.write(cmdStatus);
60+
} catch(e) {
61+
this.close();
62+
}
5963
};
6064

6165
BigRedButton.prototype.interpretData = function(error, data) {

0 commit comments

Comments
 (0)