Skip to content

feat(ember): Stop warning for onError usage #16547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/ember/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ following Ember specific configuration:

```javascript
ENV['@sentry/ember'] = {
// Will silence Ember.onError warning without the need of using Ember debugging tools.
ignoreEmberOnErrorWarning: false,

// Will disable automatic instrumentation of performance.
// Manual instrumentation will still be sent.
disablePerformance: true,
Expand Down
25 changes: 3 additions & 22 deletions packages/ember/addon/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assert, warn } from '@ember/debug';
import { assert } from '@ember/debug';
import type Route from '@ember/routing/route';
import { next } from '@ember/runloop';
import { getOwnConfig, isDevelopingApp, macroCondition } from '@embroider/macros';
import { getOwnConfig } from '@embroider/macros';
import type { BrowserOptions } from '@sentry/browser';
import { startSpan } from '@sentry/browser';
import * as Sentry from '@sentry/browser';
Expand All @@ -12,7 +11,6 @@ import {
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
} from '@sentry/core';
import Ember from 'ember';
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';

function _getSentryInitConfig(): EmberSentryConfig['sentry'] {
Expand Down Expand Up @@ -45,24 +43,7 @@ export function init(_runtimeConfig?: BrowserOptions): Client | undefined {
const sentryInitConfig = _getSentryInitConfig();
Object.assign(sentryInitConfig, initConfig);

const client = Sentry.init(initConfig);

if (macroCondition(isDevelopingApp())) {
if (environmentConfig.ignoreEmberOnErrorWarning) {
return client;
}
next(null, function () {
warn(
'Ember.onerror found. Using Ember.onerror can hide some errors (such as flushed runloop errors) from Sentry. Use Sentry.captureException to capture errors within Ember.onError or remove it to have errors caught by Sentry directly. This error can be silenced via addon configuration.',
!Ember.onerror,
{
id: '@sentry/ember.ember-onerror-detected',
},
);
});
}

return client;
return Sentry.init(initConfig);
}

type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
Expand Down
3 changes: 3 additions & 0 deletions packages/ember/addon/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
export type EmberSentryConfig = {
sentry: BrowserOptions & { browserTracingOptions?: BrowserTracingOptions };
transitionTimeout: number;
/**
* @deprecated This option is no longer used and will be removed in the next major version.
*/
ignoreEmberOnErrorWarning: boolean;
disableInstrumentComponents: boolean;
disablePerformance: boolean;
Expand Down
1 change: 0 additions & 1 deletion packages/ember/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = function (environment) {
},
},
},
ignoreEmberOnErrorWarning: true,
minimumRunloopQueueDuration: 0,
minimumComponentRenderDuration: 0,
};
Expand Down
Loading