From 2ebe826306731cf93b163c6d764b0460f021e9a0 Mon Sep 17 00:00:00 2001 From: Rasmus Gerdin Date: Wed, 19 Aug 2020 20:55:00 +0200 Subject: [PATCH] sentry: move level setter to main instead of setting in for each error --- src/events/rtbyteCommandError.js | 1 - src/events/rtbyteEventError.js | 1 - src/events/rtbyteFinalizerError.js | 1 - src/events/rtbyteMonitorError.js | 1 - src/events/rtbyteTaskError.js | 1 - src/lib/RTByteSentry.js | 1 + 6 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/events/rtbyteCommandError.js b/src/events/rtbyteCommandError.js index 02e3a9ee..91f3ca7a 100644 --- a/src/events/rtbyteCommandError.js +++ b/src/events/rtbyteCommandError.js @@ -11,7 +11,6 @@ module.exports = class extends Event { async run(message, command, params, error) { Sentry.withScope(scope => { scope.setTag('error-type', 'command'); - scope.setLevel(this.client.options.production ? 'error' : 'debug'); scope.setContext('Message', message); Sentry.captureException(error); diff --git a/src/events/rtbyteEventError.js b/src/events/rtbyteEventError.js index 33ea5d8d..490dba7a 100644 --- a/src/events/rtbyteEventError.js +++ b/src/events/rtbyteEventError.js @@ -12,7 +12,6 @@ module.exports = class extends Event { async run(event, args, error) { Sentry.withScope(scope => { scope.setTag('error-type', 'event'); - scope.setLevel(this.client.options.production ? 'error' : 'debug'); Sentry.captureException(error); }); diff --git a/src/events/rtbyteFinalizerError.js b/src/events/rtbyteFinalizerError.js index bbd7a37b..498c91c1 100644 --- a/src/events/rtbyteFinalizerError.js +++ b/src/events/rtbyteFinalizerError.js @@ -11,7 +11,6 @@ module.exports = class extends Event { async run(message, command, response, timer, finalizer, error) { Sentry.withScope(scope => { scope.setTag('error-type', 'finalizer'); - scope.setLevel(this.client.options.production ? 'error' : 'debug'); scope.setContext('Message', message); Sentry.captureException(error); diff --git a/src/events/rtbyteMonitorError.js b/src/events/rtbyteMonitorError.js index 19a75a15..1f6c7396 100644 --- a/src/events/rtbyteMonitorError.js +++ b/src/events/rtbyteMonitorError.js @@ -11,7 +11,6 @@ module.exports = class extends Event { async run(message, monitor, error) { Sentry.withScope(scope => { scope.setTag('error-type', 'monitor'); - scope.setLevel(this.client.options.production ? 'error' : 'debug'); scope.setContext('Message', message); Sentry.captureException(error); diff --git a/src/events/rtbyteTaskError.js b/src/events/rtbyteTaskError.js index 50e5a72f..2a4af873 100644 --- a/src/events/rtbyteTaskError.js +++ b/src/events/rtbyteTaskError.js @@ -11,7 +11,6 @@ module.exports = class extends Event { async run(scheduledTask, task, error) { Sentry.withScope(scope => { scope.setTag('error-type', 'task'); - scope.setLevel(this.client.options.production ? 'error' : 'debug'); scope.setContext(scheduledTask); Sentry.captureException(error); diff --git a/src/lib/RTByteSentry.js b/src/lib/RTByteSentry.js index b6bb78db..9f1ab903 100644 --- a/src/lib/RTByteSentry.js +++ b/src/lib/RTByteSentry.js @@ -16,6 +16,7 @@ Sentry.configureScope(scope => { 'klasa-version': klasaVersion, 'd.js-version': discordVersion }); + scope.setLevel(this.client.options.production ? 'error' : 'debug'); }); if (sentryIngestURL) console.log('Sentry.io error reporting is active.');