jQuery's ajaxError global event fires in prod Ember app but not in dev


I have an Ember app that is part of a bigger Web application (ASP.NET MVC) and one of the many scripts the Web app loads (e.g. myapp.com/shared/ajax.js) defines a handler for jQuery’s ajaxError global event. This handler will show a pop-up with a terse error message, which it’s OK since it was considered kind of a “measure of last resort”.

In my Ember app, I have a template (application-error.hbs) that handles the error sub-state at the application level, so any errors (including the ones coming from the RESTAdapter) get nicely rendered within the Ember app. Furthermore, while developing the Ember app and using it as part of the bigger Web app, back-end errors (e.g. 403 responses from my WebAPI server) never made it to the ajaxError global handler.

However, if I use the production version of my Ember app (e.g. ember build -prod), the generated vendor.js file (where jQuery is bundled) is somehow different because now any AJAX errors (e.g. RESTAdapter gets a 403 response) make it to the ajaxError global event. The following is the relevant part of my ember-cli-build.js file:

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    vendorFiles: {
      'jquery.js': {
        development: 'bower_components/jquery/dist/jquery.js',
        production: false

I’d like to know the cause of the difference in behavior between the prod and non-prod version of the vendor.js file and how can I keep the non-prod behavior in the production version. I realize that maybe the behavior of the production version is the correct behavior or that maybe this has nothing to do with Ember CLI and it’s totally jQuery’s fault, so any in-depth explanaition would be greatly appreciated.


I just ran into a very similar problem. When an error was returned, the error appeared to be swallowed by Ember and didn’t make it to my global ajaxError handler. After adding a global error handler on my Ember application (by specifying a error action on routes/application.js), the jquery ajaxError was also being called.


Which version of Ember are you on? There was an error swallowing bug that was getting resolved just recently on some of the latest versions of Ember