Skip to main content

format_error_json

Function format_error_json 

Source
pub fn format_error_json(err: &CliError) -> Value
Expand description

Formats a CliError as a JSON value with a consistent error envelope:

{
  "schemaVersion": 1,
  "error": {
    "code": "callisto::some_code",
    "message": "human-readable error text",
    "help": "optional guidance string or null"
  }
}

"code", "message", and "help" are always present; "help" is null when the diagnostic provides no help text. This guarantees a stable shape regardless of which CliError variant is serialized.