feat: add sentry error logging to dotnet-api and rust crates

This commit is contained in:
alyssa 2025-02-23 18:49:31 +00:00
parent 8266100155
commit 63777bf810
8 changed files with 86 additions and 38 deletions

View file

@ -62,8 +62,13 @@ public class Startup
await ctx.Response.WriteJSON(400, "{\"message\":\"400: Bad Request\",\"code\":0}");
else if (exc.Error is not PKError)
{
await ctx.Response.WriteJSON(500, "{\"message\":\"500: Internal Server Error\",\"code\":0}");
var sentryEvent = new SentryEvent(exc.Error);
SentrySdk.CaptureEvent(sentryEvent);
}
// for some reason, if we don't specifically cast to ModelParseError, it uses the base's ToJson method
else if (exc.Error is ModelParseError fe)
await ctx.Response.WriteJSON(fe.ResponseCode, JsonConvert.SerializeObject(fe.ToJson()));