error_json

Function error_json 

Source
pub fn error_json(msg: &str) -> String
Expand description

Converts an error message to a JSON error string.

Creates a JSON object with a single “error” field containing the message. Used in WASM bindings to return error information to JavaScript.

§Examples

let json = error_json("Invalid input");
assert_eq!(json, r#"{"error":"Invalid input"}"#);