It is just an abstraction so you do not have to throw exceptions at every single point in your app. If you would do that and decide to change the way your exception messages are printed, you would have to change many places in your app. With this factory, you change it in one place.
catcher
is a closure (read here what a closure is). It is basically a function that returns a function that you can then call with another value. Think of it as you are preparing the catcher with your message and later plug in the value that is supposed to be reported as well. In his data service you see him use the catcher as follows:
function getPeople() {
return $http.get('/api/people')
.then(success)
.catch(fail);
...
function fail(e) {
return exception.catcher('XHR Failed for getPeople')(e);
}
Utilizing the closure, you could do this as well:
function getPeople() {
return $http.get('/api/people')
.then(success)
.catch(exception.catcher('XHR Failed for getPeople'));