naofireblade / homebridge-weather-plus

A comprehensive weather plugin for homebridge.
MIT License
314 stars 63 forks source link

It crashes Homebridge if WU PWS is down. #75

Closed mwkchan closed 4 years ago

mwkchan commented 4 years ago

It crashes Homebridge if WU PWS is down.

[9/30/2019, 3:31:42 AM] SyntaxError: Unexpected end of JSON input at JSON.parse (:null:null) at WundergroundAPI. (/usr/local/lib/node_modules/homebridge-weather-plus/api/weatherunderground.js:45:38) at Request.self.callback (/usr/local/lib/node_modules/homebridge-weather-plus/node_modules/request/request.js:185:22) at Request.emit (events.js:203:13) at Request. (/usr/local/lib/node_modules/homebridge-weather-plus/node_modules/request/request.js:1161:10) at Request.emit (events.js:203:13) at IncomingMessage. (/usr/local/lib/node_modules/homebridge-weather-plus/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:291:20) at IncomingMessage.emit (events.js:208:15) at endReadableNT (_stream_readable.js:1154:12) at processTicksAndRejections (internal/process/task_queues.js:77:11)

[9/30/2019, 3:31:42 AM] Got SIGTERM, shutting down Homebridge...

naofireblade commented 4 years ago

Thanks for reporting. Will fix this.

knuckleheadsmiff commented 4 years ago

I just got this today too. Need to add a try catch. I added the code to put in in a different issue (before I saw this.)

naofireblade commented 4 years ago

Fixed and published in v2.8.2.

agneevX commented 4 years ago

Still present with OWM.

[4/15/2020, 20:21:28] TypeError: Cannot read property 'warn' of undefined
    at Object.getConditionCategoryOwm (/usr/lib/node_modules/homebridge-weather-plus/util/converter.js:118:12)
    at OpenWeatherMapAPI.parseReport (/usr/lib/node_modules/homebridge-weather-plus/apis/openweathermap.js:105:40)
    at OpenWeatherMapAPI.<anonymous> (/usr/lib/node_modules/homebridge-weather-plus/apis/openweathermap.js:72:10)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-weather-plus/node_modules/openweather-apis/index.js:250:18)
    at IncomingMessage.emit (events.js:322:22)
    at endReadableNT (_stream_readable.js:1187:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
[4/15/2020, 20:21:28] Got SIGTERM, shutting down Homebridge...