skydiver / ewelink-api

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

fix JSON parse error when device is offline #111

Closed luiguild closed 3 years ago

luiguild commented 3 years ago

add 503 error and fix makeRequest mixin when device is Offline or Service is unavailable

luiguild commented 3 years ago

I made this to solve the JSON parse error when ewelink cloud returns 503, please merge or suggest improvements in my implementation :)

you can check a simple use of your ewelink API abstraction here > https://github.com/cyberlabsai/ewelink-serverless-vercel

skydiver commented 3 years ago

Hey @luiguild

PR looks great, i like how you are catching errors ...

After testing this one i need to say, it's amazing how many "503 Service Temporarily Unavailable" errors ewelink throws ...