Skip to content

Commit

Permalink
fix: possible json deserializer exception
Browse files Browse the repository at this point in the history
Log if DiscordJson fails
  • Loading branch information
Lulalaby committed Jul 14, 2024
1 parent 209a7ca commit 7d9566a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions DisCatSharp/Net/Serialization/DiscordJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ private static void DiscordJsonErrorHandler(object? sender, ErrorEventArgs e, Ba
var sentryMessage = "DiscordJson error on deserialization (" + (sender?.GetType().Name ?? "x") + ")\n\n" +
"Path: " + e.ErrorContext.Path + "\n" +
"Original Object" + e.ErrorContext.OriginalObject + "\n" +
"Current Object" + e.CurrentObject;
"Current Object" + e.CurrentObject + "\n\n" +
"JRE Message:" + jre.Message + "\n" +
"JRE Line Number: " + jre.LineNumber + "\n" +
"JRE Line Position" + jre.LinePosition + "\n" +
"JRE Path" + jre.Path;
SentryEvent sentryEvent = new(new DiscordJsonException(jre))
{
Level = SentryLevel.Error,
Logger = nameof(DiscordJson),
Message = sentryMessage
Message = Utilities.StripIds(sentryMessage, discord.Configuration.EnableDiscordIdScrubber)
};
sentryEvent.SetFingerprint(BaseDiscordClient.GenerateSentryFingerPrint(sentryEvent));
if (discord.Configuration.AttachUserInfo && discord.CurrentUser is not null)
Expand Down

0 comments on commit 7d9566a

Please sign in to comment.