Skip to content

Commit 5fc0388

Browse files
mydeaLms24
andauthored
feat(ember): Stop warning for onError usage (#16547)
This deprecates the `ignoreEmberOnErrorWarning` option, as it is no longer used. Previously, we logged a warnining if we detected that this was used. But the option is now deprecated/will be removed, and since there is no real logic attached to this we can simply remove this (as well as the usage of the global `Ember` namespace) to avoid deprecations. Closes #16504 --------- Co-authored-by: Lukas Stracke <[email protected]>
1 parent a72ca10 commit 5fc0388

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
lines changed

packages/ember/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ following Ember specific configuration:
7070

7171
```javascript
7272
ENV['@sentry/ember'] = {
73-
// Will silence Ember.onError warning without the need of using Ember debugging tools.
74-
ignoreEmberOnErrorWarning: false,
75-
7673
// Will disable automatic instrumentation of performance.
7774
// Manual instrumentation will still be sent.
7875
disablePerformance: true,

packages/ember/addon/index.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { assert, warn } from '@ember/debug';
1+
import { assert } from '@ember/debug';
22
import type Route from '@ember/routing/route';
3-
import { next } from '@ember/runloop';
4-
import { getOwnConfig, isDevelopingApp, macroCondition } from '@embroider/macros';
3+
import { getOwnConfig } from '@embroider/macros';
54
import type { BrowserOptions } from '@sentry/browser';
65
import { startSpan } from '@sentry/browser';
76
import * as Sentry from '@sentry/browser';
@@ -12,7 +11,6 @@ import {
1211
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
1312
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
1413
} from '@sentry/core';
15-
import Ember from 'ember';
1614
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';
1715

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

48-
const client = Sentry.init(initConfig);
49-
50-
if (macroCondition(isDevelopingApp())) {
51-
if (environmentConfig.ignoreEmberOnErrorWarning) {
52-
return client;
53-
}
54-
next(null, function () {
55-
warn(
56-
'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.',
57-
!Ember.onerror,
58-
{
59-
id: '@sentry/ember.ember-onerror-detected',
60-
},
61-
);
62-
});
63-
}
64-
65-
return client;
46+
return Sentry.init(initConfig);
6647
}
6748

6849
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;

packages/ember/addon/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
55
export type EmberSentryConfig = {
66
sentry: BrowserOptions & { browserTracingOptions?: BrowserTracingOptions };
77
transitionTimeout: number;
8+
/**
9+
* @deprecated This option is no longer used and will be removed in the next major version.
10+
*/
811
ignoreEmberOnErrorWarning: boolean;
912
disableInstrumentComponents: boolean;
1013
disablePerformance: boolean;

packages/ember/tests/dummy/config/environment.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ module.exports = function (environment) {
3232
},
3333
},
3434
},
35-
ignoreEmberOnErrorWarning: true,
3635
minimumRunloopQueueDuration: 0,
3736
minimumComponentRenderDuration: 0,
3837
};

0 commit comments

Comments
 (0)