Skip to content

Commit

Permalink
Log errors received during setClimateOn (#13)
Browse files Browse the repository at this point in the history
* Log errors received during setClimateOn

* Make error test not dependent on format of error messaging

* Bump version number
  • Loading branch information
samrum committed Sep 19, 2019
1 parent 4664680 commit 0014e68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-onstar",
"version": "1.2.5",
"version": "1.2.6",
"description": "Unofficial OnStar plugin for Homebridge",
"main": "dist/index.js",
"types": "dist/src/index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/CommandDelegator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class CommandDelegator {

reply(null);
} catch (e) {
reply(`Error: ${e.message}`);
const errorMessage = `setClimateOn: Error: ${e.message}`;

this.log(errorMessage);
reply(errorMessage);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/CommandDelegator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ describe("OnStarAccessory", () => {
when(onStarMock.start()).thenThrow(new Error(errorMessage));

commandDelegator.setClimateOn(true, (error: string) => {
expect(error).toEqual(`Error: ${errorMessage}`);
expect(error).toBeDefined;
expect(error).not.toBeNull;
done();
});
});
Expand Down

0 comments on commit 0014e68

Please sign in to comment.