diff options
author | Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> | 2023-06-21 14:18:22 -0400 |
---|---|---|
committer | Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> | 2023-06-21 14:18:22 -0400 |
commit | 8bc8113926e35484f5441b9448f6025a708b24d2 (patch) | |
tree | f3698de83a158c8f04d4d49a5a12c3bb49d86e72 | |
parent | 2c60696d3de006d79545c4d57e7fd3d833cd9e74 (diff) | |
download | compiler-explorer-gh-7934.tar.gz compiler-explorer-gh-7934.zip |
Improve sentry capturinggh-7934
-rw-r--r-- | static/analytics.ts | 3 | ||||
-rw-r--r-- | static/main.ts | 6 | ||||
-rw-r--r-- | static/sentry.ts | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/static/analytics.ts b/static/analytics.ts index 8681680ae..e15f207b0 100644 --- a/static/analytics.ts +++ b/static/analytics.ts @@ -23,9 +23,6 @@ // POSSIBILITY OF SUCH DAMAGE. import {options} from './options.js'; -import {SetupSentry} from './sentry.js'; - -SetupSentry(); class GAProxy { private hasBeenEnabled = false; diff --git a/static/main.ts b/static/main.ts index 0ff81f756..13c9066a4 100644 --- a/static/main.ts +++ b/static/main.ts @@ -22,7 +22,10 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -// setup analytics before anything else so we can capture any future errors in sentry +// Setup sentry before anything else so we can capture errors +import {SetupSentry, SentryCapture} from './sentry.js'; +SetupSentry(); + import {ga as analytics} from './analytics.js'; import 'whatwg-fetch'; @@ -61,7 +64,6 @@ import {CompilerExplorerOptions} from './global.js'; import {ComponentConfig, EmptyCompilerState, StateWithId, StateWithLanguage} from './components.interfaces.js'; import * as utils from '../lib/common-utils.js'; -import {SentryCapture} from './sentry.js'; import {Printerinator} from './print-view.js'; const logos = require.context('../views/resources/logos', false, /\.(png|svg)$/); diff --git a/static/sentry.ts b/static/sentry.ts index 80d8a1d40..2fab2b845 100644 --- a/static/sentry.ts +++ b/static/sentry.ts @@ -35,6 +35,9 @@ export function SetupSentry() { release: options.release, environment: options.sentryEnvironment, }); + window.addEventListener('unhandledrejection', event => { + SentryCapture(event.reason, 'Unhandled Promise Rejection'); + }); } } |