From f799cfdb68cea5f0b531cf37f2a57cc604a9fad5 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Thu, 18 May 2017 02:13:31 +0000 Subject: [PATCH] Fix Error Messages --- commands/nsfw/gelbooru.js | 1 + commands/nsfw/rule34.js | 1 + 2 files changed, 2 insertions(+) diff --git a/commands/nsfw/gelbooru.js b/commands/nsfw/gelbooru.js index fa4917fa..31158326 100644 --- a/commands/nsfw/gelbooru.js +++ b/commands/nsfw/gelbooru.js @@ -37,6 +37,7 @@ module.exports = class GelbooruCommand extends Command { limit: 1 }); const { posts } = await xml(text); + if (!posts) throw new Error('No Results.'); return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] }) .catch(err => msg.say(`${err.name}: ${err.message}`)); } catch (err) { diff --git a/commands/nsfw/rule34.js b/commands/nsfw/rule34.js index f329183c..cbcb6144 100644 --- a/commands/nsfw/rule34.js +++ b/commands/nsfw/rule34.js @@ -37,6 +37,7 @@ module.exports = class Rule34Command extends Command { limit: 1 }); const { posts } = await xml(text); + if (!posts) throw new Error('No Results.'); return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] }) .catch(err => msg.say(`${err.name}: ${err.message}`)); } catch (err) {