Ember 2.16 Modules API - How to import Ember.onerror?

What is the correct import statement for Ember.onerror with the new modules API?

Same for Ember.testing and Ember.Logger.

ember-modules-codemod does not migrate these imports.


1 Like

If the codemod does not migrate an import, it usually means that you should keep importing it the same way. We will have a migration path for every module before fully deprecating the ember package.

We haven’t decided on the final import path for Ember.onerror.

Ultimately, you will import and invoke getter/setter functions (instead of setting a property on a global). The major issue is what the exact import path would be.

For example, something like (but with an actual good import path):

import { setOnerror } from '@ember/error-utils';

Any one have good ideas on the import path?

I don’t think adding another sub-package for setOnerror is necessary here. A few ideas from looking at existing sub-packages:

  1. @ember/object/evented: setOnerror can be thought of as a special case of Ember.on.
  2. @ember/application: onerror can be thought of as the application error handler.
  3. @ember/error: Just put the handler where the event itself lives. (Probably not a good idea, though.)


This looks just great! import { onerror } from '@ember/application';