Repository navigation
feat: add WithMechanism capture option - #1472
sharmis-tp wants to merge 6 commits into
Conversation
|
Thanks for the review! Updated in 994ea63:
All root-package tests pass with |
giortzisg
left a comment
There was a problem hiding this comment.
looks good, left some small recommendations
|
Pushed — removed the "message is unaffected" test case as suggested. All remaining tests pass. |
2ed04e2 to
bd5c921
Compare
|
Simplified |
giortzisg
left a comment
There was a problem hiding this comment.
Looks good. Let's do the integrations followup before merging though.
Adds a
sentry.WithMechanism(*sentry.Mechanism)capture option, so the exception mechanism (type, handled flag, data) can be set for a single capture through the existingCaptureOptionAPI. This works forCaptureException,RecoverandCaptureEvent, both the package-level functions and theClientmethods:Until now every SDK capture reported a
genericmechanism (or none for a single error), so integrations could not report their own mechanism type, as the exception mechanism spec asks for, and there was no public way to mark an exception as unhandled.How it behaves:
CaptureExceptionorRecover. Exceptions deeper in the error chain keep theirchainedmechanism.ExceptionID,ParentID,SourceandIsExceptionGrouplink the exception chain together, so they are kept from the mechanism the SDK generated rather than taken from the option. An emptyTypekeeps the generated type, or falls back togeneric.prepareEvent, before event processors andBeforeSend, so both see the final mechanism.*Mechanismis copied, includingHandledandData, so integrations can share one package-level value across captures without callbacks changing it.As agreed in the issue, the integrations will switch to their own mechanism types in a follow-up PR.
Issues