fix: make callModule a wrapper function that calls handleError

This commit is contained in:
Derrick Hammer 2023-07-29 19:32:45 -04:00
parent 6f036eae12
commit 73ea9ca5b0
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}