Adding some error handling
This commit is contained in:
parent
f1d65a65d1
commit
88b2ec26c9
20
functions.js
20
functions.js
@ -27,14 +27,18 @@ const dotCommandFiles = fs.readdirSync('./dot-commands/').filter(file => file.en
|
||||
|
||||
// MySQL database connection
|
||||
const mysql = require('mysql');
|
||||
const db = new mysql.createPool({
|
||||
connectionLimit: 10,
|
||||
host: dbHost,
|
||||
user: dbUser,
|
||||
password: dbPass,
|
||||
database: dbName,
|
||||
port: dbPort,
|
||||
});
|
||||
try {
|
||||
const db = new mysql.createPool({
|
||||
connectionLimit: 10,
|
||||
host: dbHost,
|
||||
user: dbUser,
|
||||
password: dbPass,
|
||||
database: dbName,
|
||||
port: dbPort,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
const functions = {
|
||||
// Functions for managing and creating Collections
|
||||
|
15
main.js
15
main.js
@ -191,8 +191,14 @@ client.on('messageCreate', message => {
|
||||
if (lowerContent.includes('ligma')) message.reply('ligma balls, goteem');
|
||||
|
||||
// Break the message down into its components and analyze it
|
||||
const commandData = fn.dot.getCommandData(message);
|
||||
console.log(commandData);
|
||||
try {
|
||||
const commandData = fn.dot.getCommandData(message);
|
||||
if(isDev) console.log(commandData);
|
||||
} catch(error) {
|
||||
console.error(error);
|
||||
message.reply('There was an error trying to execute that command.');
|
||||
}
|
||||
|
||||
|
||||
if (commandData.isValid && commandData.isCommand) {
|
||||
try {
|
||||
@ -206,4 +212,9 @@ client.on('messageCreate', message => {
|
||||
return;
|
||||
});
|
||||
|
||||
process.on("uncaughtException", err => {
|
||||
console.error('There was an uncaught error: ', err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
client.login(token);
|
Loading…
Reference in New Issue
Block a user