awulder / angular-prismicio

AngularJS service for prismic.io
MIT License
32 stars 15 forks source link

Some errors returned by server are lost #9

Closed dlecan closed 10 years ago

dlecan commented 10 years ago

Some errors returned by server are lost when, for eg., a bad predicate is provided.

Prismic.all().then(function(data) {
   self.data = data;
   // If server error, data is null
});

If I want to chain several http calls, I can't chain promises because I need to test data content.

A better design is to handle error here and here and to reject the promise.

Strangely, this design is already used here and here.

Do you agree ?

awulder commented 10 years ago

I totally agree! If you want you can send me a pull request if you like?