From 2b90358ca52ba06a1e16963400bf4b56dac5fc70 Mon Sep 17 00:00:00 2001 From: Runebaas Date: Sat, 2 Mar 2019 00:50:54 -0500 Subject: [PATCH] Remove Bugsnag --- Geekbot.net/Geekbot.net.csproj | 2 - Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs | 67 +++---------------- 2 files changed, 10 insertions(+), 59 deletions(-) diff --git a/Geekbot.net/Geekbot.net.csproj b/Geekbot.net/Geekbot.net.csproj index 0ed34e8..9e98f9b 100755 --- a/Geekbot.net/Geekbot.net.csproj +++ b/Geekbot.net/Geekbot.net.csproj @@ -19,8 +19,6 @@ true - - 2.0.1 diff --git a/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs b/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs index 7d5deec..c6e1f8d 100644 --- a/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs +++ b/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Net; using System.Threading.Tasks; -using Bugsnag; -using Bugsnag.Payload; using Discord.Commands; using Discord.Net; using Geekbot.net.Lib.GlobalSettings; @@ -21,7 +18,6 @@ namespace Geekbot.net.Lib.ErrorHandling private readonly ITranslationHandler _translation; private readonly IRavenClient _raven; private readonly bool _errorsInChat; - private readonly IClient _bugsnag; public ErrorHandler(IGeekbotLogger logger, ITranslationHandler translation, IGlobalSettings globalSettings, bool errorsInChat) { @@ -39,21 +35,6 @@ namespace Geekbot.net.Lib.ErrorHandling { _raven = null; } - - var bugsnagApiKey = globalSettings.GetKey("BugsnagApiKey"); - if (!string.IsNullOrEmpty(bugsnagApiKey)) - { - _bugsnag = new Bugsnag.Client(new Bugsnag.Configuration - { - ApiKey = bugsnagApiKey, - AppVersion = Constants.BotVersion() - }); - _logger.Information(LogSource.Geekbot, "Command Errors will be logged to Bugsnag"); - } - else - { - _bugsnag = null; - } } public async Task HandleCommandException(Exception e, ICommandContext context, string errorMessage = "def") @@ -109,46 +90,18 @@ namespace Geekbot.net.Lib.ErrorHandling private void ReportExternal(Exception e, MessageDto errorObj) { - if (_raven != null) + if (_raven == null) return; + var sentryEvent = new SentryEvent(e) { - var sentryEvent = new SentryEvent(e) + Tags = { - Tags = - { - ["discord_server"] = errorObj.Guild.Name, - ["discord_user"] = errorObj.User.Name - }, - Message = errorObj.Message.Content, - Extra = errorObj - }; - _raven.Capture(sentryEvent); - } - - _bugsnag?.Notify(e, (report) => - { - report.Event.Metadata.Add("Discord Location", new Dictionary - { - {"Guild Name", errorObj.Guild.Name}, - {"Guild Id", errorObj.Guild.Id}, - {"Channel Name", errorObj.Channel.Name}, - {"Channel Id", errorObj.Channel.Id} - }); - report.Event.Metadata.Add("Message Info", new Dictionary - { - {"Content", errorObj.Message.Content}, - {"Id", errorObj.Message.Id}, - {"Attachments", errorObj.Message.Attachments.ToString()}, - {"ChannelMentions", errorObj.Message.ChannelMentions.ToString()}, - {"UserMentions", errorObj.Message.UserMentions.ToString()}, - {"RoleMentions", errorObj.Message.RoleMentions.ToString()}, - }); - report.Event.Severity = Severity.Error; - report.Event.User = new User - { - Id = errorObj.User.Id, - Name = errorObj.User.Name - }; - }); + ["discord_server"] = errorObj.Guild.Name, + ["discord_user"] = errorObj.User.Name + }, + Message = errorObj.Message.Content, + Extra = errorObj + }; + _raven.Capture(sentryEvent); } } } \ No newline at end of file