Skip to main content

build_cli_error

Function build_cli_error 

Source
pub fn build_cli_error(message: &str) -> Value
Expand description

Build a standard CLI parse error value.

Use when Cli::try_parse() fails or a flag value is invalid. Print with output_json and exit with code 2.

let err = agent_first_data::build_cli_error("--output: invalid value 'xml'");
assert_eq!(err["code"], "error");
assert_eq!(err["error_code"], "invalid_request");
assert_eq!(err["retryable"], false);