MCPcopy Create free account
hub / github.com/dfinity/orbit / to_json_string

Method to_json_string

libs/orbit-essentials/src/api.rs:45–58  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

43 }
44
45 pub fn to_json_string(&self) -> String {
46 let mut map = HashMap::new();
47 map.insert("code".to_string(), self.code.clone());
48 map.insert(
49 "message".to_string(),
50 self.message.clone().unwrap_or("".to_string()),
51 );
52 map.insert(
53 "details".to_string(),
54 json!(&self.details.clone().unwrap_or_default()).to_string(),
55 );
56
57 json!(map).to_string()
58 }
59}
60
61pub trait DetailableError {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected