Macro invalid_field_err

Source
macro_rules! invalid_field_err {
    ( $context:expr, $field:expr , $reason:expr $(,)? ) => { ... };
    ( $field:expr , $reason:expr $(,)? ) => { ... };
}
Expand description

Creates an “invalid field” error with context information.

This macro generates an error indicating that a field in a data structure or input is invalid for some reason.

§Arguments

  • context - The context in which the error occurred (optional)
  • field - The name of the invalid field
  • reason - The reason why the field is invalid

§Examples

use ironrdp_core::invalid_field_err;

let err = invalid_field_err!("user input", "Age", "must be positive");

§Note

If the context is not provided, it will use the current function name.