diff --git a/d2m/discord-packets.js b/d2m/discord-packets.js index 09818276..ed47faea 100644 --- a/d2m/discord-packets.js +++ b/d2m/discord-packets.js @@ -181,7 +181,7 @@ const utils = { } catch (e) { // Let OOYE try to handle errors too - eventDispatcher.onError(client, e, message) + await eventDispatcher.onError(client, e, message) } } } diff --git a/d2m/event-dispatcher.js b/d2m/event-dispatcher.js index 7f27b77e..57cb72cd 100644 --- a/d2m/event-dispatcher.js +++ b/d2m/event-dispatcher.js @@ -50,7 +50,7 @@ module.exports = { * @param {Error} e * @param {import("cloudstorm").IGatewayMessage} gatewayMessage */ - onError(client, e, gatewayMessage) { + async onError(client, e, gatewayMessage) { console.error("hit event-dispatcher's error handler with this exception:") console.error(e) // TODO: also log errors into a file or into the database, maybe use a library for this? or just wing it? definitely need to be able to store the formatted event body to load back in later console.error(`while handling this ${gatewayMessage.t} gateway event:`) @@ -83,7 +83,7 @@ module.exports = { builder.addLine(`Error trace:\n${stackLines.join("\n")}`, `
Error trace
${stackLines.join("\n")}
`) } builder.addLine("", `
Original payload
${util.inspect(gatewayMessage.d, false, 4, false)}
`) - api.sendEvent(roomID, "m.room.message", { + await api.sendEvent(roomID, "m.room.message", { ...builder.get(), "moe.cadence.ooye.error": { source: "discord",