chore: clean up .net sentry exceptions
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled

This commit is contained in:
alyssa 2026-01-25 06:53:15 -05:00
parent ce0983ba16
commit 09ed215e6c
6 changed files with 38 additions and 17 deletions

View file

@ -2,6 +2,8 @@ using Autofac.Extensions.DependencyInjection;
using PluralKit.Core;
using Sentry;
using Serilog;
namespace PluralKit.API;
@ -21,9 +23,16 @@ public class Program
opts.Dsn = config.SentryUrl ?? "";
opts.Release = BuildInfoService.FullVersion;
opts.AutoSessionTracking = true;
// opts.DisableTaskUnobservedTaskExceptionCapture();
opts.DisableUnobservedTaskExceptionCapture();
});
TaskScheduler.UnobservedTaskException += (_, e) =>
{
foreach (var inner in e.Exception.Flatten().InnerExceptions)
SentrySdk.CaptureException(inner);
e.SetObserved();
};
await host.Services.GetRequiredService<RedisService>().InitAsync(config);
await host.RunAsync();
}