Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to exception mechanism data #2294

Merged
merged 8 commits into from
Apr 11, 2023
Merged

Conversation

mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented Apr 7, 2023

This PR address several items related to the exception.mechanism data sent to Sentry.

  • Prevents an empty mechanism. Either exception.mechanism is omitted, or the exception.mechanism.type field will be set. Defaults the mechanism type to "generic" when not set by another method.
    Fixes Exception mechanism type unset #2288.

  • Moves extra data added to System.Exception.Data to the exception.mechanism.data collection, instead of placing it in exception.extra. This places it near the exception in the issue details page, and renders it correctly.
    Fixes Move exception data to mechanism #2289.

  • Adds descriptions to exception mechanisms for built-in integrations, and a new SetSentryMechanism extension method for convenience. Also adds a property for the synthetic field. Omits it unless true. The default is false.
    Fixes Unused mechanism fields #2290.

  • Sets exception.mechanism.handled to true in the case of an exception that was thrown, caught, and manually captured. As an example:

    try
    {
        // ... something that throws an exception
    }
    catch (Exception ex)
    {
        // this will now be correctly marked as handled:true
        SentrySdk.CaptureException(ex);
    }

    Fixes Add handled:true when an exception has been handled #1480.

@mattjohnsonpint
Copy link
Contributor Author

mattjohnsonpint commented Apr 7, 2023

Note, many of these items are prerequisites for #2240 - coming soon with #2287.

@mattjohnsonpint mattjohnsonpint marked this pull request as draft April 7, 2023 02:02
@mattjohnsonpint mattjohnsonpint marked this pull request as ready for review April 7, 2023 04:26
@mattjohnsonpint
Copy link
Contributor Author

mattjohnsonpint commented Apr 11, 2023

Here are some screenshots of how this looks in Sentry:

Caught and handled exception:

image

Uncaught exception (hovering over the mechanism for description popup):

image

Captured exception that was never thrown:

image

@mattjohnsonpint mattjohnsonpint merged commit abf765f into main Apr 11, 2023
@mattjohnsonpint mattjohnsonpint deleted the fix/mechanism branch April 11, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants