Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (11 sloc) 400 Bytes
module = angular.module("mb.services", [])
module.factory "httpErrorsInterceptor", [
"$injector", "$q", "alerts", ($injector, $q, alerts) ->
(promise) ->
$http = $injector.get("$http")
onError = (response) ->
errorMessage = response.data?.error || "Unexpected HTTP error"
alerts.error(errorMessage)
$q.reject(response)
promise.then(null, onError)
]