Skip to content

Ember.onerror (and import of global Ember) is deprecated – all usage can probably be removed #16504

Closed
@johanrd

Description

@johanrd

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/ember

SDK Version

9.27.0

Framework Version

ember 6.5.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

See current usage of global Ember import here:

import Ember from 'ember';

And usage of Ember.onerrorhere:

Steps to Reproduce

  1. Go here https://deprecations.emberjs.com/id/deprecate-import-onerror-from-ember and see that importing global Ember is deprecated, and that there is no replacement for Ember.onerror

The usage of Ember.onerror has been discourged for a while, and not been in the docs since Ember v5.8 (May 15, 2024)

The current docs is to simply add an event listener to the 'error' event on window:

import fetch from 'fetch';
// ...
window.addEventListener('error', function(error) {
  fetch('/error-notification', {
    method: 'POST',
    body: JSON.stringify({
      stack: error.stack,
      otherInformation: 'exception message'
    })
  });
});

Expected Result

No imports from global Ember, specifically Ember.onerror since that is the only one used by Sentry. I guess having an event listener on the 'error' event is already handled by sentry, so the special logic for Ember.onerror can simply be removed, I think.

Actual Result

See reproduction.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions