Improved error handling

This commit is contained in:
Essem 2021-07-31 13:36:00 -05:00
parent 7b07f82285
commit 77ca0fd344
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 13 additions and 9 deletions

View file

@ -3,6 +3,7 @@ const database = require("../utils/database.js");
const logger = require("../utils/logger.js");
const collections = require("../utils/collections.js");
const parseCommand = require("../utils/parseCommand.js");
const { clean } = require("../utils/misc.js");
// run when someone sends a message
module.exports = async (client, cluster, worker, ipc, message) => {
@ -141,7 +142,7 @@ module.exports = async (client, cluster, worker, ipc, message) => {
await client.createMessage(message.channel.id, Object.assign({
content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: <https://github.com/esmBot/esmBot/issues>"
}, reference), [{
file: `Message: ${error}\n\nStack Trace: ${error.stack}`,
file: `Message: ${await clean(error)}\n\nStack Trace: ${await clean(error.stack)}`,
name: "error.txt"
}]);
} catch { /* silently ignore */ }