Skip to content

Commit

Permalink
#17 Tratando a messagem de erro do github
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauricio Melo committed Feb 5, 2015
1 parent 948920f commit 0e2877e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/scripts/services/github/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,14 @@ angular.module('cmsApp')
github.put(address, {
data: commit,
cache: false
}).error(function(status, message){
console.log(status, message);
}).error(function(error){
console.log(error);
var message = error.responseJSON.message;
if(error.status === 422) {
message = 'Essa notícia já existe.';
}

return deferred.reject(message);
}).then(function(data){
return deferred.resolve(data);
});
Expand Down

0 comments on commit 0e2877e

Please sign in to comment.