Skip to content

Commit

Permalink
fix: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Elin Angelow committed Jun 7, 2024
1 parent 6f7cbd6 commit 342f429
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/methods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Methods = ({

return class methods {
constructor () {
wires.register((...args) => this.test(...args));
wires.register(async(...args) => await this.test(...args));
this.namespace = config?.namespace || '';
this.uid = uidCounter();
}
Expand Down Expand Up @@ -170,7 +170,7 @@ const Methods = ({
let mr = data;
try {
if (mr.method === mr.meta?.caller) { // this is response, it calls auto generated fn that resolves promise only
return m.fn(data);
return await m.fn(data);
}
const r = await Promise.resolve(
m.fn(
Expand All @@ -188,7 +188,7 @@ const Methods = ({
mr.params = r;
} catch (e) {
mr.params = undefined;
mr.error = e?.error?.stack || e?.stack;
mr.error = e?.error?.stack || e?.stack || e?.error || e;
this.log('error', 'Methods', mr.error, callData);
}
if (!data.id) {
Expand Down

0 comments on commit 342f429

Please sign in to comment.