Commit 23828f6a authored by Alex Navasardyan's avatar Alex Navasardyan

adding promise#fail

parent da80daf2
......@@ -116,7 +116,7 @@ Errors also propagate:
```javascript
getJSON("/posts.json").then(function(posts) {
}).then(null, function(error) {
}).fail(function(error) {
// since no rejection handler was passed to the
// first `.then`, the error propagates.
});
......@@ -131,7 +131,7 @@ getJSON("/post/1.json").then(function(post) {
return getJSON(post.commentURL);
}).then(function(comments) {
// proceed with access to posts and comments
}).then(null, function(error) {
}).fail(function(error) {
// handle errors in either of the two requests
});
```
......
......@@ -120,6 +120,10 @@ Promise.prototype = {
});
return thenPromise;
},
fail: function(fail) {
return Promise.prototype.then.call(this, null, fail);
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment