You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL/DR
Catching Global Exception is not working due to the this.get('isRavenUsable') in ember-cli-sentry that does not have any dependent key. Needed to overwrite using the ember-cli-deploy-sentry RavenService.
I wasn't sure if should post this here, or in the ember-cli-sentry repo, but they are too much related imho to make a good choice :)
Background
I was running into problems where I would only see "Error Error" as the error message in Sentry for Uncaught Global Exceptions. The following setting was set to true for my environment:
// config/environment.js /** * If set to true, addon will try to have Ember.onerror * and Ember.RSVP.on('error') captured by Raven. * * @type {Boolean} * @default true */globalErrorCatching: true,
enableGlobalErrorCatching(){// This guy here 'isRavenUsable' was never flipping from false to true after isSetup was done.if(this.get('isRavenUsable')&&!this.get('globalErrorCatchingInitialized')){const_oldOnError=Ember.onerror;Ember.onerror=(error)=>{if(this._ignoreError(error)){return;}
....etc..
The Problem
After debugging I could work out why the following was always set to false: this.get('isRavenUsable') in the ember-cli-sentry code. It's a computed property that somehow never changes its value anymore (as it does not have any dependent keys).
My solution
Now, I made a solution for this is partly using the README of the ember-cli-sentry-deploy repo that suggest to use the 'RavenService' that comes with it, instead of the ember-cli-sentry raven service. So I made an app-initializer much like the one that looks like https://github.com/ember-cli-sentry/ember-cli-sentry/blob/v4.1.0/app/instance-initializers/raven-setup.js, but I've made some alterations here:
import{get,computed}from'@ember/object';importRavenfrom'raven';importRavenServicefrom'ember-cli-deploy-sentry/services/raven';importENVfrom'webapp/config/environment';constUsableRavenService=RavenService.extend({// Overwriting 'isRavenUsable' to have a dependent key 'ravenOptions', No fastbooth check is done here, is not needed for my // use case.isRavenUsable: computed('ravenOptions',function(){returnRaven.isSetup()===true;})});exportfunctioninitialize(container){constconfig=ENV;if(get(config,'sentry.development')===true){if(get(config,'sentry.debug')===true){console.info('`sentry` is configured for development mode.');}return;}if(!config.sentry){thrownewError('`sentry` should be configured when not in development mode.');}constraven=UsableRavenService.create();raven.setup(config);container.register('service:raven',raven,{instantiate: false})}exportdefault{name: 'raven',initialize: initialize};
TODO
Setup Raven correctly as part of ember-cli-deploy-sentry or document on how to this correctly to capture global exceptions.
The text was updated successfully, but these errors were encountered:
icyrizard
changed the title
Enable Global Catching Errors - Faulty Setup.
Unable to Global Catching Errors - Faulty Setup.
Feb 2, 2021
icyrizard
changed the title
Unable to Global Catching Errors - Faulty Setup.
Unable to Catch Global Catching Errors - Faulty Raven Service Setup.
Feb 2, 2021
TL/DR
Catching Global Exception is not working due to the
this.get('isRavenUsable')
inember-cli-sentry
that does not have any dependent key. Needed to overwrite using theember-cli-deploy-sentry
RavenService.I wasn't sure if should post this here, or in the
ember-cli-sentry
repo, but they are too much related imho to make a good choice :)Background
I was running into problems where I would only see "Error Error" as the error message in Sentry for Uncaught Global Exceptions. The following setting was set to true for my environment:
The 'ember-cli-sentry' plugin has a function that is called after the plugin is initialized, namely:
https://github.com/ember-cli-sentry/ember-cli-sentry/blob/v4.1.0/addon/services/raven.js#L175
The Problem
After debugging I could work out why the following was always set to false:
this.get('isRavenUsable')
in theember-cli-sentry
code. It's a computed property that somehow never changes its value anymore (as it does not have any dependent keys).My solution
Now, I made a solution for this is partly using the README of the
ember-cli-sentry-deploy
repo that suggest to use the 'RavenService' that comes with it, instead of theember-cli-sentry
raven service. So I made an app-initializer much like the one that looks likehttps://github.com/ember-cli-sentry/ember-cli-sentry/blob/v4.1.0/app/instance-initializers/raven-setup.js
, but I've made some alterations here:TODO
Setup Raven correctly as part of
ember-cli-deploy-sentry
or document on how to this correctly to capture global exceptions.The text was updated successfully, but these errors were encountered: