sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Consider `Mechanism.Handled` for non-thrown captured exceptions

Open bitsandfoxes opened this issue 9 months ago • 21 comments

The MainExceptionProcessor handles setting the mechanism here: https://github.com/getsentry/sentry-dotnet/blob/c30052e99d981aec3d6ff1bda42c3395a2376fe7/src/Sentry/Internal/MainExceptionProcessor.cs#L177-L188

So this code ends up with Handled = true

try
{
    throw new Exception();
}
catch (Exception ex)
{
    // will be marked as handled 
    SentrySdk.CaptureException(ex);
}

And this code ends up with Handled -- in the issue's Highlights

// will not be marked as anything
SentrySdk.CaptureException(new Exception());

Screenshot 2024-05-23 at 13 32 53

Interestingly, captured messages are Handled -- too.

Which, personally, I find confusing. If an exception is not unhandled, should we not consider it handled implicitly? I'm not talking technical correctness here but user expectations.

But I can still filter issues based on error.handled:false so maybe it doesn't matter?

bitsandfoxes avatar May 23 '24 11:05 bitsandfoxes