pub struct CaptureExceptionOptions { /* private fields */ }Expand description
Optional context for capture_exception_with: person identity, custom
properties, groups, trace context, and exception fingerprint/level.
All fields are optional. An empty options set (new() / Default)
captures the exception personlessly with no extra context. With the
trace-context provider configured on ErrorTrackingOptions, its trace
and span IDs are attached automatically; values set here take precedence.
§Examples
use posthog_rs::CaptureExceptionOptions;
let options = CaptureExceptionOptions::new()
.distinct_id("user-123")
.property("route", "/checkout")?
.group("company", "acme")
.trace_context(
"00000000000000000000000000000123",
"0000000000000456",
)
.fingerprint("checkout-error")
.level("warning");Implementations§
Source§impl CaptureExceptionOptions
impl CaptureExceptionOptions
Sourcepub fn distinct_id<S: Into<String>>(self, distinct_id: S) -> Self
pub fn distinct_id<S: Into<String>>(self, distinct_id: S) -> Self
Associate the exception with a person.
Sourcepub fn property<K: Into<String>, V: Serialize>(
self,
key: K,
value: V,
) -> Result<Self, Error>
pub fn property<K: Into<String>, V: Serialize>( self, key: K, value: V, ) -> Result<Self, Error>
Add a custom property to the exception event.
Sourcepub fn group<N: Into<String>, I: Into<String>>(
self,
group_name: N,
group_id: I,
) -> Self
pub fn group<N: Into<String>, I: Into<String>>( self, group_name: N, group_id: I, ) -> Self
Capture the exception as a group event.
Sourcepub fn trace_context<T: Into<String>, S: Into<String>>(
self,
trace_id: T,
span_id: S,
) -> Self
pub fn trace_context<T: Into<String>, S: Into<String>>( self, trace_id: T, span_id: S, ) -> Self
Associate the exception with a span in a distributed trace.
The IDs are accepted together so an exception can never combine a trace ID and span ID from different contexts. This pair overrides any context returned by the client’s trace-context provider.
Sourcepub fn fingerprint<S: Into<String>>(self, fingerprint: S) -> Self
pub fn fingerprint<S: Into<String>>(self, fingerprint: S) -> Self
Set a custom exception fingerprint.
Trait Implementations§
Source§impl Clone for CaptureExceptionOptions
impl Clone for CaptureExceptionOptions
Source§fn clone(&self) -> CaptureExceptionOptions
fn clone(&self) -> CaptureExceptionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more