handle and log failures to enact consequences

This commit is contained in:
jesopo 2022-09-23 09:43:20 +00:00
parent 55fc94c4c2
commit 30eab1991b

View File

@ -952,6 +952,7 @@ export class Mjolnir {
private async handleConsequences(protection: Protection, roomId: string, eventId: string, sender: string, consequences: Consequence[]) {
for (const consequence of consequences) {
try {
if (consequence.name === "alert") {
/* take no additional action, just print the below message to management room */
} else if (consequence.name === "ban") {
@ -976,6 +977,9 @@ export class Mjolnir {
types: [consequence.name],
}
});
} catch (e) {
await this.logMessage(LogLevel.ERROR, "handleConsequences", `Failed to enact ${consequence.name} consequence: ${e}`);
}
}
}