Skip to content

Instantly share code, notes, and snippets.

@ahlusar1989
Last active December 22, 2016 17:02
Show Gist options
  • Save ahlusar1989/f5e2bf72ded1f7c0ac20d045071d7c57 to your computer and use it in GitHub Desktop.
Save ahlusar1989/f5e2bf72ded1f7c0ac20d045071d7c57 to your computer and use it in GitHub Desktop.
app.use(function* (next) {
this.accountService = {};
for (const method in accountServiceClient) {
this.accountService[method] = function* () {
try {
return yield accountServiceClient[method].apply(null, arguments);
}
catch (e) {
requestLogger.error(e);
throw e;
}
};
}
this.legacyApi = {};
for (const method in apiLegacyClient) {
this.legacyApi[method] = function* () {
try {
return yield apiLegacyClient[method].apply(null, arguments);
}
catch (e) {
requestLogger.error(e);
throw e;
}
};
}
yield next;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment