error handling
This commit is contained in:
parent
4e4ab100ec
commit
afd3b7197e
1 changed files with 4 additions and 5 deletions
|
@ -64,17 +64,16 @@ module.exports = class {
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
if (json.errors) {
|
if (json.errors) {
|
||||||
console.log(json.errors)
|
json.errors.forEach(error => {
|
||||||
for (const error in json.errors) {
|
|
||||||
console.log(error);
|
|
||||||
if (error.message.startsWith('No Pokémon found')) {
|
if (error.message.startsWith('No Pokémon found')) {
|
||||||
message.channel.createMessage(
|
message.channel.createMessage(
|
||||||
`${client.constants.emojis.userError} I tried really hard, but I couldn't find any Pokemon called \`${query}\``
|
`${client.constants.emojis.userError} I couldn't find any Pokemon called ${query}c`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
client.logger.error('POKEMON_FETCH_ERROR', error.message);
|
client.logger.error('POKEMON_FETCH_ERROR', error.message);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue