skydiver / ewelink-api

eWeLink API for JavaScript
https://www.npmjs.com/package/ewelink-api
MIT License
267 stars 108 forks source link

Resolve/Reject async methods instead passing error/status field #59

Open BadCoder1337 opened 4 years ago

BadCoder1337 commented 4 years ago

Resolving/Rejecting is a promise core feature. With that you can use trycatch in async contexts. instead return { error, msg: 'Device does not exist' } use throw { error, msg: 'Device does not exist' }