Make command error logs more verbose, image server connection/job error handling changes
This commit is contained in:
parent
03ed19d239
commit
bd221d5909
2 changed files with 6 additions and 4 deletions
|
@ -144,7 +144,7 @@ module.exports = async (client, cluster, ipc, message) => {
|
||||||
content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size."
|
content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size."
|
||||||
}, reference));
|
}, reference));
|
||||||
} else {
|
} else {
|
||||||
logger.error(error.toString());
|
logger.error(`Error occurred with command message ${message.cleanContent}: ${error.toString()}`);
|
||||||
try {
|
try {
|
||||||
await client.createMessage(message.channel.id, Object.assign({
|
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>"
|
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>"
|
||||||
|
|
|
@ -199,14 +199,15 @@ const start = (object, num) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}).catch((result) => {
|
||||||
|
throw result;
|
||||||
}).then((addr) => {
|
}).then((addr) => {
|
||||||
const event = new EventEmitter();
|
const event = new EventEmitter();
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve, reject) => {
|
||||||
event.once("uuid", (uuid) => resolve({ event, uuid, addr }));
|
event.once("uuid", (uuid) => resolve({ event, uuid, addr }));
|
||||||
|
event.once("error", reject);
|
||||||
this.jobs[num] = { event, addr };
|
this.jobs[num] = { event, addr };
|
||||||
});
|
});
|
||||||
}, (result) => {
|
|
||||||
throw result;
|
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
delete this.jobs[num];
|
delete this.jobs[num];
|
||||||
this.jobs[data.uuid] = { event: data.event, addr: data.addr };
|
this.jobs[data.uuid] = { event: data.event, addr: data.addr };
|
||||||
|
@ -286,6 +287,7 @@ exports.run = object => {
|
||||||
resolve(payload);
|
resolve(payload);
|
||||||
});
|
});
|
||||||
data.event.once("error", (err) => {
|
data.event.once("error", (err) => {
|
||||||
|
delete this.jobs[data.uuid];
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue