Skip to main content

emit_error_json_with_suggestion

Function emit_error_json_with_suggestion 

Source
pub fn emit_error_json_with_suggestion(
    code: i32,
    message: &str,
    suggestion: Option<&str>,
)
Expand description

GAP-SG-39: emits an actionable JSON error envelope to stdout, including an optional suggestion field carrying the remediation hint derived from the error variant. Ensures even silent write failures (e.g. remember rejecting a malformed name) surface both the cause and how to fix it on stdout: {"error": true, "code": <code>, "message": "...", "suggestion": "..."}. A BrokenPipe error is silenced; a hand-rolled fallback preserves the contract when serialization itself fails.