CICCIOSGAMINO / openweather-apis

Simple APIs for OpenWeatherMap.org basic services
GNU General Public License v3.0
44 stars 27 forks source link

Cannot read property '0' of undefined #22

Closed Dynrothe closed 6 years ago

Dynrothe commented 7 years ago

How could I fix this error: C:\Users\\Desktop\\node_modules\openweather-apis\index.js:155 return callback(err, (jsonObj.weather)[0].description); ^ TypeError: Cannot read property '0' of undefined I get it when it can't find the city

EDIT: I fixed it myself

Longlius commented 6 years ago

How'd you fix it?

Dynrothe commented 6 years ago

Made this modification in the module's index.js under "active functions()". Might not be the best way to do it but it's enough for me https://pastebin.com/rp3FLayw

CICCIOSGAMINO commented 6 years ago

I think its better get the error and handle it in the main section the openweather-apis is used rather then silence return ....