Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,36 @@ ajax.raw('/foo').then(function(result) {
});
```

Error Handling
--------------

You can handle errors per each request as follows. Note that the jQuery response object for the error is accessible via `.jqXHR`:

```js
ajax("my/path", {
data: data
}).then(function(response) {
return console.log(response.message);
}, function(error) {
return doSomething(error.jqXHR.responseJSON);
});
```

Global AJAX error handling can also be implemented using jQuery (does not require this plugin):

```js
ApplicationRoute = Em.Route.extend({
init: function() {
this._super();
return Em.$(document).ajaxError(function(evt, jqxhr) {
return console.log(evt);
});
}
});

export default ApplicationRoute;
```

Simplified Testing
------------------

Expand Down