feat(interaction-router): Adds error handling

This commit is contained in:
Michel Fedde 2025-06-30 22:41:00 +02:00
parent 62a32c8222
commit 05d113cccf

View file

@ -37,6 +37,7 @@ export class InteractionRouter {
async route(interaction: Interaction) { async route(interaction: Interaction) {
const interactionType = this.findInteractionType(interaction); const interactionType = this.findInteractionType(interaction);
try {
switch (interactionType) { switch (interactionType) {
case InteractionRoutingType.Unrouted: case InteractionRoutingType.Unrouted:
this.logger.debug("Unroutable interaction found...") this.logger.debug("Unroutable interaction found...")
@ -54,6 +55,9 @@ export class InteractionRouter {
case InteractionRoutingType.MenuSubmit: case InteractionRoutingType.MenuSubmit:
this.events.dispatch(new ComponentInteractionEvent(<ButtonInteraction | AnySelectMenuInteraction>interaction)) this.events.dispatch(new ComponentInteractionEvent(<ButtonInteraction | AnySelectMenuInteraction>interaction))
} }
} catch (err: any) {
this.logger.fatal(err);
}
} }
private findInteractionType(interaction: Interaction): InteractionRoutingType { private findInteractionType(interaction: Interaction): InteractionRoutingType {