Skip to main content

classify_error

Function classify_error 

Source
pub fn classify_error(message: &str) -> (String, i32)
Expand description

Classify a CLI error string into a structured JSON envelope plus a differentiated process exit code.

JSON-RPC errors arrive Display-formatted as [-32602] <message>. The numeric code is surfaced as a stable envelope code (CALLER_ERROR / RUNTIME_ERROR) instead of collapsing every RPC failure to one code, and caller errors (-32602) get a distinct non-zero exit so scripts can tell a bad request apart from a server/runtime failure.