Better Error Handling

This commit is contained in:
Daniel Odendahl Jr
2017-05-05 21:37:30 +00:00
parent d8a773958d
commit 13cbd23f2f
54 changed files with 120 additions and 156 deletions
+2 -1
View File
@@ -28,6 +28,7 @@ module.exports = class IMDBCommand extends Command {
try {
const { body } = await request
.get(`http://www.omdbapi.com/?t=${query}&plot=full`);
if(body.Error) throw new Error('No Results.');
const embed = new RichEmbed()
.setColor(0xDBA628)
.setAuthor('IMDB', 'https://i.imgur.com/sXwwIQs.png')
@@ -50,7 +51,7 @@ module.exports = class IMDBCommand extends Command {
body.Actors);
return msg.embed(embed);
} catch(err) {
return msg.say('An Error Occurred. The film may not have been found.');
return msg.say(`An Error Occurred: ${err}`);
}
}
};