I finally got Angular promise error handling down but it was counter-intuitive to me. I expected errors to be handled by the failure callback but instead I had to use a catch. <
The second argument should be almost never be used literally in application code while also using the first. It is mostly about promise library interoperability between different implementations.
You should always use .catch
unless you specifically have some weird corner case where you need .then(succcess, fail)
.
See The .then(success, fail) anti-pattern.
Also Q library (The one angular $q is based on) has similar section in their readme