Skip to main content

config_err_sensitive

Macro config_err_sensitive 

Source
macro_rules! config_err_sensitive {
    ($code:expr, $op:literal, $public:literal, $sensitive:expr) => { ... };
    ($code:expr, $op:literal, $fmt:literal, $sensitive:expr $(, sanitized!($arg:expr))+ $(,)?) => { ... };
}
Expand description

Create a configuration error with sensitive internal context.

§Arguments

  • $code: &ErrorCode
  • $op: Operation literal
  • $public: Public deceptive literal or format
  • $sensitive: Sensitive data for internal only (recommend sanitizing)

§Security

  • Public: Lie from $public
  • Internal: Sensitive with operation

§Example

let secret = "key";
let err = config_err_sensitive!(
    &definitions::CFG_VALIDATION_FAILED,
    "auth",
    "Configuration invalid",
    sanitized!(secret)
);