From 73ea9ca5b08d9ef4a8b2f54ba4174a66e6e3ec2f Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 29 Jul 2023 19:32:45 -0400 Subject: [PATCH] fix: make callModule a wrapper function that calls handleError --- src/module/client.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/module/client.ts b/src/module/client.ts index 4fa19d3..26b6cc2 100644 --- a/src/module/client.ts +++ b/src/module/client.ts @@ -39,7 +39,12 @@ export abstract class Client extends Emittery { public getBound(module: string): ModuleBagBound { return { - callModule: callModule.bind(undefined, module), + callModule: async (...args: any) => { + const ret = await this.callModule(module, ...args); + this.handleError(ret); + + return ret; + }, connectModule: connectModule.bind(undefined, module), } as ModuleBagBound; }