user606521
user606521

Reputation: 15434

How to catch jquery exception on ajax bad request?

I am saving user model like this:

this.model.save(data,{
                    success: function(user) {
                        console.log(user);
                    },
                    error: function() {
                        console.log("error");
                    }

                });

REST api returns 400 (Bad request) when for example user name is not unique). In console the "error" is displayed but BEFORE it there is jquery execption:

POST http://localhost/cms/users.json 400 (Bad Request)

how can I catch this exception so its not thrown to console?

Upvotes: 1

Views: 1418

Answers (1)

neeebzz
neeebzz

Reputation: 11538

The exceptions are showed up on console as a feature of the browser (plug-in in case of Firebug). You cannot turn it off and it doesn't affect your code flow in any manner. You should be ignoring it.

Check this for another similar q

Upvotes: 2

Related Questions