}).catch(function errorCallback(response) {
setTimeout(function() {throw response});
//using setTimeout moves the actual throwingout of the
// promise chain. It's kind of a hack!
return $q.reject(response) //reReject the error, so the rest
// of the chain knows there is something wrong
});