From aec89a28c7dd324d570f063b4ad13c5132db09f8 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 24 Mar 2020 15:09:34 -0400 Subject: [PATCH] Still throw errors in pokemon fetch if it's not a 404 --- commands/search/pokedex.js | 1 - package.json | 2 +- structures/pokemon/PokemonStore.js | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index 1e795e46..5fc95e0d 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -52,7 +52,6 @@ module.exports = class PokedexCommand extends Command { .setThumbnail(data.spriteImageURL); return msg.embed(embed); } catch (err) { - if (err.status === 404) return msg.say('Could not find any results.'); return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } diff --git a/package.json b/package.json index a5270f29..e88d4847 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.14.2", + "version": "112.14.3", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/pokemon/PokemonStore.js b/structures/pokemon/PokemonStore.js index 24378757..5ed61c3d 100644 --- a/structures/pokemon/PokemonStore.js +++ b/structures/pokemon/PokemonStore.js @@ -21,8 +21,9 @@ module.exports = class PokemonStore extends Collection { const pokemon = new Pokemon(body); this.set(pokemon.id, pokemon); return pokemon; - } catch { - return null; + } catch (err) { + if (err.status === 404) return null; + throw err; } } };