Skip to content

Commit 00c8bb6

Browse files
Use Error object for promise rejection (#181)
* Fix typos (#180) * Use Error object for promise rejection --------- Co-authored-by: Donavan Becker <beckersmarthome@icloud.com>
1 parent c9eb43e commit 00c8bb6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/switchbot-device-wocurtain.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SwitchbotDeviceWoCurtain extends SwitchbotDevice {
4949

5050
/* ------------------------------------------------------------------
5151
* runToPos()
52-
* - run to the targe position
52+
* - run to the target position
5353
*
5454
* [Arguments]
5555
* - percent | number | Required | the percentage of target position
@@ -63,7 +63,7 @@ class SwitchbotDeviceWoCurtain extends SwitchbotDevice {
6363
return new Promise((resolve, reject) => {
6464
reject(
6565
new Error(
66-
"The type of target position percentage is incorrent: " +
66+
"The type of target position percentage is incorrect: " +
6767
typeof percent
6868
)
6969
);
@@ -75,7 +75,7 @@ class SwitchbotDeviceWoCurtain extends SwitchbotDevice {
7575
if (typeof mode != "number") {
7676
return new Promise((resolve, reject) => {
7777
reject(
78-
new Error("The type of running mode is incorrent: " + typeof mode)
78+
new Error("The type of running mode is incorrect: " + typeof mode)
7979
);
8080
});
8181
}

lib/switchbot-device.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ class SwitchbotDevice {
444444
this._connect()
445445
.then(() => {
446446
if (!this._chars) {
447-
return reject("No characteristics available.");
447+
return reject(new Error("No characteristics available."));
448448
}
449449
return this._write(this._chars.write, req_buf);
450450
})

0 commit comments

Comments
 (0)