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 -3
View File
@@ -20,9 +20,8 @@ module.exports = class BinaryCommand extends Command {
prompt: 'What text would you like to convert to binary?',
type: 'string',
validate: text => {
if(binary(text).length < 2000)
return true;
return 'Your message content is too long.';
if(binary(text).length < 2000) return true;
return 'Your text is too long.';
},
parse: text => binary(text)
}
+2 -3
View File
@@ -14,9 +14,8 @@ module.exports = class CowsayCommand extends Command {
prompt: 'What text would you like the cow to say?',
type: 'string',
validate: text => {
if(text.length < 1500)
return true;
return `Please keep your content under 1500 characters, you have ${text.length}.`;
if(text.length < 1500) return true;
return 'Invalid Text. Text must be under 1500 characters.';
}
}
]
+2 -3
View File
@@ -15,9 +15,8 @@ module.exports = class MorseCommand extends Command {
prompt: 'What text would you like to convert to morse?',
type: 'string',
validate: text => {
if(letterTrans(text, dictionary, ' ').length < 1999)
return true;
return 'Your message content is too long.';
if(letterTrans(text, dictionary, ' ').length < 1999) return true;
return 'Your text is too long.';
},
parse: text => letterTrans(text.toLowerCase(), dictionary, ' ')
}
+2 -3
View File
@@ -15,9 +15,8 @@ module.exports = class PirateCommand extends Command {
prompt: 'What text would you like to convert to pirate?',
type: 'string',
validate: text => {
if(wordTrans(text, dictionary).length < 1999)
return true;
return 'Your message content is too long.';
if(wordTrans(text, dictionary).length < 1999) return true;
return 'Your text is too long.';
},
parse: text => wordTrans(text, dictionary)
}
+2 -3
View File
@@ -15,9 +15,8 @@ module.exports = class TemmieCommand extends Command {
prompt: 'What text would you like to convert to Temmie speak?',
type: 'string',
validate: text => {
if(wordTrans(text, dictionary).length < 1999)
return true;
return 'Your message content is too long.';
if(wordTrans(text, dictionary).length < 1999) return true;
return 'Your text is too long.';
},
parse: text => wordTrans(text, dictionary)
}
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = class WebhookCommand extends Command {
.send({ content });
return null;
} catch(err) {
return msg.say('An Unknown Error Occurred.');
return msg.say(`An Error Occurred: ${err}`);
}
}
};
+2 -3
View File
@@ -14,9 +14,8 @@ module.exports = class ZalgoCommand extends Command {
prompt: 'What text would you like to convert to zalgo?',
type: 'string',
validate: text => {
if(text.length < 500)
return true;
return `Please keep your text under 500 characters, you have ${text.length}.`;
if(text.length < 500) return true;
return 'Invalid Text. Text must be under 500 characters.';
},
parse: text => zalgo(text)
}