From 374a12bb9221ea91f8a5dcb0ddbcc9616b0425bd Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Sat, 9 Sep 2023 01:08:56 -0500 Subject: [PATCH] fix error callbacks not being stored --- src/core/structures/module-store.ts | 1 + src/core/structures/services/module-manager.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/core/structures/module-store.ts b/src/core/structures/module-store.ts index 6e754e1..e83b551 100644 --- a/src/core/structures/module-store.ts +++ b/src/core/structures/module-store.ts @@ -7,6 +7,7 @@ import { CoreModuleStore } from '../contracts'; * For interacting with modules, use the ModuleManager instead. */ export class ModuleStore implements CoreModuleStore { + onError = new WeakMap(); metadata = new WeakMap(); commands = new Map(); } diff --git a/src/core/structures/services/module-manager.ts b/src/core/structures/services/module-manager.ts index 74f1aa7..588531b 100644 --- a/src/core/structures/services/module-manager.ts +++ b/src/core/structures/services/module-manager.ts @@ -11,6 +11,13 @@ import { CommandType } from '../enums'; export class DefaultModuleManager implements ModuleManager { constructor(private moduleStore: CoreModuleStore) {} + getErrorCallback(m: Module): Function | undefined { + return this.moduleStore.onError.get(m); + } + setErrorCallback(m: Module, c: Function): void { + this.moduleStore.onError.set(m, c); + } + getByNameCommandType(name: string, commandType: T) { const id = this.get(Id.create(name, commandType)); if (!id) {