Improve error handling in JavaScript promises

This commit is contained in:
Francis Lachapelle
2015-01-08 16:11:07 -05:00
parent a702ddeddd
commit 297aec838c
2 changed files with 14 additions and 8 deletions
+4 -1
View File
@@ -76,7 +76,10 @@
params: params
})
.success(deferred.resolve)
.error(deferred.reject);
.error(function(data, status) {
if (status == 404)
return deferred.reject();
});
return deferred.promise;
};