Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions validated-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,23 @@ perhaps you meant to throw an error?`);

return this.run.bind(methodInvocation)(args);
}

_executeAsync(methodInvocation = {}, args) {
//Add `this.name` to reference the Method name
methodInvocation.name = this.name;

try {
const validateResult = this.validate.bind(methodInvocation)(args);

if (typeof validateResult !== 'undefined') {
throw new Error('Returning from validate doesn\'t do anything; Perhaps you meant to throw an error?');
}

return this.run.bind(methodInvocation)(args);
} catch (err) {
return Promise.reject(err);
}
}
};

// Mixins get a chance to transform the arguments before they are passed to the actual Method
Expand Down