Answer the question
In order to leave comments, you need to log in
How to handle TypeError: Cannot read property 'weather' of null?
I want the program to say 'you entered the wrong city' when naming a non-existent city in city.
How can I fix the code or handle the error so that it does not appear?
The code:
var weather = require('openweather-apis');
weather.setAPPID('TOKEN')
weather.setLang('ru')
weather.setUnits('metric')
let city = 'шцовлвлцщдй'
weather.setCity(city)
weather.getDescription(function(err, desc){
console.log(desc)
});
Answer the question
In order to leave comments, you need to log in
So I just opened this module on npm, and I immediately see:
New Version of the package (Node.js > 16) can be found at the new package domain @cicciosgamino/openweather-apis
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question