Skip to content

Instantly share code, notes, and snippets.

@markmcdermid
Last active August 5, 2016 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markmcdermid/6380af590b6276cae6f3e423e55893bc to your computer and use it in GitHub Desktop.
Save markmcdermid/6380af590b6276cae6f3e423e55893bc to your computer and use it in GitHub Desktop.
app.get(routes.employer.main, wrapWithCatch(handlers.getEmployers));
try {
doSomething()
} catch (e) {
console.log(e)
}
module.exports = function(originalFunction) {
return function(req, res, next) {
return originalFunction.call(this, req, res, next)
.catch(function(err) {
Logger.error({ msg: 'Error Caught In Wrapper', params: {err: err.message}});
next(err);
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment