Skip to main content

SensitiveError

Derive Macro SensitiveError 

Source
#[derive(SensitiveError)]
{
    // Attributes available to this derive:
    #[sensitive]
    #[error]
}
Expand description

Derives redaction::SensitiveType for types that should log without Serialize.

This emits the same traversal and redacted Debug impls as Sensitive, but uses a slog::Value implementation that logs a redacted string derived from a display template.

The display template is taken from #[error("...")] (thiserror-style) or from doc comments (displaydoc-style). If neither is present, the derive fails with a compile error to avoid accidental exposure of sensitive fields.

Classified fields referenced in the template are redacted by applying the policy to an owned copy of the field value, so those field types must implement Clone.