feat(events): Adds error handling to eventHandlers
This commit is contained in:
parent
5c7c9c9f87
commit
6d7a0e7cfb
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import cron, {validate} from "node-cron";
|
||||
import {Class} from "../types/Class";
|
||||
import {randomUUID} from "node:crypto";
|
||||
import {Container} from "../Container/Container";
|
||||
import {Logger} from "log4js";
|
||||
|
||||
export type EventConfiguration = {
|
||||
name: string,
|
||||
|
|
@ -49,7 +51,11 @@ export class EventHandler {
|
|||
}
|
||||
|
||||
this.eventHandlers.get(eventName)?.forEach((handler) => {
|
||||
try {
|
||||
handler(event);
|
||||
} catch (e: any) {
|
||||
Container.get<Logger>("logger").error(e);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue