Skip to content

Add overload to the public API to take Action<Scope> #675

@bruno-garcia

Description

@bruno-garcia

On the IHub methods like CaptureEvent, CaptureMessage and CaptureException should have an overload that takes: Action<Scope>.

The implementation should do what WithScope does, it pushes a scope, and passes the instance to the callback to be mutated. The result is then applied (normal code path of CaptureEvent(event, scope).

This serves as a replacement to the api:

SentrySdk.WithScope(s =>
{
	s...;
	// Odd call to static method in callback. Data passed magically through the callback
	SentrySdk.CaptureX 
});

This exists on sentry-cocoa:
https://github.com/getsentry/sentry-cocoa/blob/29d1e9f2353f1a9514b2549b1de56e83f136658d/Sources/Sentry/SentrySDK.m#L146-L151

Metadata

Metadata

Labels

FeatureNew feature or requestQuestionFurther information is requested
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions