fix error logging

This commit is contained in:
murm 2023-03-15 10:42:13 -04:00
parent c841b53bdd
commit 492cdba631

View file

@ -100,6 +100,17 @@ export default async function (matrixClient, event, room, toStartOfTimeline) {
}
} catch (error) {
logger.log("error", error.stack)
try {
const errorcontent = {
body: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
msgtype: "m.text"
}
matrixClient.sendEvent(event.event.room_id, "m.room.message", errorcontent, "", (err, res) => {
console.log(err);
});
} catch (e) {
_error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`);
}
// if (error.toString().includes("Request entity too large")) {
// await client.rest.channels.createMessage(event.event.room_id, Object.assign({
// content: "The resulting file was too large to upload. Try again with a smaller image if possible."