diff --git a/src/Bot/Bot.csproj b/src/Bot/Bot.csproj
index c64eecb..998456c 100644
--- a/src/Bot/Bot.csproj
+++ b/src/Bot/Bot.csproj
@@ -29,7 +29,7 @@
-
+
diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
index 463c4e9..dfce63b 100644
--- a/src/Core/Core.csproj
+++ b/src/Core/Core.csproj
@@ -33,7 +33,7 @@
-
+
diff --git a/src/Core/ErrorHandling/ErrorHandler.cs b/src/Core/ErrorHandling/ErrorHandler.cs
index 60d97e9..a5ccc8e 100644
--- a/src/Core/ErrorHandling/ErrorHandler.cs
+++ b/src/Core/ErrorHandling/ErrorHandler.cs
@@ -1,9 +1,9 @@
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.Core.Logger;
-using SharpRaven;
-using SharpRaven.Data;
+using Sentry;
using Exception = System.Exception;
namespace Geekbot.Core.ErrorHandling
@@ -12,7 +12,6 @@ namespace Geekbot.Core.ErrorHandling
{
private readonly IGeekbotLogger _logger;
private readonly Func _getDefaultErrorText;
- private readonly IRavenClient _raven;
private readonly bool _errorsInChat;
public ErrorHandler(IGeekbotLogger logger, RunParameters runParameters, Func getDefaultErrorText)
@@ -22,15 +21,15 @@ namespace Geekbot.Core.ErrorHandling
_errorsInChat = runParameters.ExposeErrors;
var sentryDsn = runParameters.SentryEndpoint;
- if (!string.IsNullOrEmpty(sentryDsn))
+ if (string.IsNullOrEmpty(sentryDsn)) return;
+
+ SentrySdk.Init(o =>
{
- _raven = new RavenClient(sentryDsn) { Release = Constants.BotVersion(), Environment = "Production" };
- _logger.Information(LogSource.Geekbot, $"Command Errors will be logged to Sentry: {sentryDsn}");
- }
- else
- {
- _raven = null;
- }
+ o.Dsn = sentryDsn;
+ o.Release = Constants.BotVersion();
+ o.Environment = "Production";
+ });
+ _logger.Information(LogSource.Geekbot, $"Command Errors will be logged to Sentry: {sentryDsn}");
}
public async Task HandleCommandException(Exception e, ICommandContext context, string errorMessage = "def")
@@ -83,18 +82,19 @@ namespace Geekbot.Core.ErrorHandling
private void ReportExternal(Exception e, MessageDto errorObj)
{
- if (_raven == null) return;
+ if (!SentrySdk.IsEnabled) return;
+
var sentryEvent = new SentryEvent(e)
{
- Tags =
- {
- ["discord_server"] = errorObj.Guild.Name,
- ["discord_user"] = errorObj.User.Name
- },
Message = errorObj.Message.Content,
- Extra = errorObj
};
- _raven.Capture(sentryEvent);
+ sentryEvent.SetTag("discord_server", errorObj.Guild.Name);
+ sentryEvent.SetExtra("Channel", errorObj.Channel);
+ sentryEvent.SetExtra("Guild", errorObj.Guild);
+ sentryEvent.SetExtra("Message", errorObj.Message);
+ sentryEvent.SetExtra("User", errorObj.User);
+
+ SentrySdk.CaptureEvent(sentryEvent);
}
}
}
\ No newline at end of file