Fix crash on weather command with invalid location
This commit is contained in:
parent
d1903c27e7
commit
d8649ff943
2 changed files with 6 additions and 3 deletions
|
@ -11,10 +11,10 @@ module.exports = async function (location) {
|
|||
});
|
||||
res.on('end', () => {
|
||||
if(res.statusCode === 404){
|
||||
reject(`Couldn't find weather for ${location}`);
|
||||
resolve(`Couldn't find weather for ${location}`);
|
||||
return;
|
||||
}else if(res.statusCode != 200){
|
||||
reject(`Something went wrong while getting the weather for ${location}`);
|
||||
resolve(`Something went wrong while getting the weather for ${location}`);
|
||||
} else{
|
||||
resolve(data);
|
||||
success = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue