Last active
August 5, 2016 22:33
-
-
Save markmcdermid/6380af590b6276cae6f3e423e55893bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get(routes.employer.main, wrapWithCatch(handlers.getEmployers)); | |
try { | |
doSomething() | |
} catch (e) { | |
console.log(e) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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