ahmadawais / corona-cli

🦠 Track the Coronavirus disease (COVID-19) in the command line. Worldwide for all countries, for one country, and the US States. Fast response time (< 100ms). https://x.com/MrAhmadAwais
https://NodeCLI.com
MIT License
1.85k stars 191 forks source link

Better error messages when api is down #37

Closed Alex61NN5 closed 4 years ago

Alex61NN5 commented 4 years ago

As I write this issue it seems that https://corona.lmao.ninja/countries is down? so the cli hangs for around 2 minutes and then spits out the following error

undefined UNHANDLED ERROR
undefined ERROR → Error
i REASON → Request failed with status code 524
i ERROR STACK ↓
 Error: Request failed with status code 524
    at createError (C:\Users\user\AppData\Roaming\npm\node_modules\corona-cli\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\Users\user\AppData\Roaming\npm\node_modules\corona-cli\node_modules\axios\lib\core\settle.js:17:12)
    at IncomingMessage.handleStreamEnd (C:\Users\user\AppData\Roaming\npm\node_modules\corona-cli\node_modules\axios\lib\adapters\http.js:236:11)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Would be better to have some sort of timeout a minute or so and then notify the user that the api is down / can't be reached

ahmadawais commented 4 years ago

DONE

🔗 https://github.com/ahmadawais/corona-cli/releases/tag/3.2.0 🔗 https://www.npmjs.com/package/corona-cli

Alex61NN5 commented 4 years ago

Beautiful! Thank you!