I'm reading through John Papa's angular style guide and came across this code under the Exception Handling section. Can someone please explain to me where reason comes from or how it works in that code? This is one of those JavaScript/Angular things I just don't get how it works.
/* recommended */
angular
.module('blocks.exception')
.factory('exception', exception);
exception.$inject = ['logger'];
function exception(logger) {
var service = {
catcher: catcher
};
return service;
function catcher(message) {
return function(reason) {
logger.error(message, reason);
};
}
}