Handle jquery ajax error

Hi,

I’m trying to handle ajax error when I load data from an API in a route. Here is my code:

export default Ember.Route.extend({
  model: function()
    return Ember.$.getJSON("url/doc.json").then (function(data){
      // success
      return data;
    }, function(){
      // fail
    });
});

When I try a wrong url this code never goes in the fail function. I am looking for explanations, What I don’t understand about promises?

Thank you for your help.

I have found the reason of my problem in the JQuery ajax doc about the error function:

Note: This handler is not called for cross-domain script and cross-domain JSONP requests.