pub struct ErrorContext { /* private fields */ }Expand description
Redaction-aware structured context for errors.
Context retains at most 16 unique catalog fields. The first value for a
name wins and insertion order is preserved. Duplicate and over-capacity
inserts are ignored and recorded by Self::is_truncated.
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn with_text(self, key: FieldKey<TextField>, value: impl AsRef<str>) -> Self
pub fn with_text(self, key: FieldKey<TextField>, value: impl AsRef<str>) -> Self
Adds bounded text under a catalog-owned text key.
Every Unicode control character is replaced with one space before the value is truncated at a UTF-8 boundary to the schema’s byte limit.
Sourcepub fn with_i64(self, key: FieldKey<I64Field>, value: i64) -> Self
pub fn with_i64(self, key: FieldKey<I64Field>, value: i64) -> Self
Adds a signed integer under a catalog-owned key.
Sourcepub fn with_u64(self, key: FieldKey<U64Field>, value: u64) -> Self
pub fn with_u64(self, key: FieldKey<U64Field>, value: u64) -> Self
Adds an unsigned integer under a catalog-owned key.
Sourcepub fn with_bool(self, key: FieldKey<BoolField>, value: bool) -> Self
pub fn with_bool(self, key: FieldKey<BoolField>, value: bool) -> Self
Adds a Boolean under a catalog-owned key.
Sourcepub fn with_secret_presence(self, key: FieldKey<SecretPresenceField>) -> Self
pub fn with_secret_presence(self, key: FieldKey<SecretPresenceField>) -> Self
Records the presence of secret-bearing input without accepting a value.
Sourcepub fn public_fields(&self) -> impl Iterator<Item = &ErrorContextField>
pub fn public_fields(&self) -> impl Iterator<Item = &ErrorContextField>
Iterates fields approved for public projections in insertion order.
Sourcepub const fn is_truncated(&self) -> bool
pub const fn is_truncated(&self) -> bool
Returns whether text, a duplicate field, or an over-capacity insert was truncated.