1 unstable release
0.0.1 | May 14, 2023 |
---|
#1178 in #cargo
18KB
280 lines
README
printjsonerr help to print json error
Usage
use jsonerr::*;
use printjsonerr::*;
fn main() {
let myjsonerr: serde_json::Value = jsonerr!(code = "ERR001", message = "An error message");
printjsonerr!(myjsonerr); // without & (added internaly)
printjsonerr!(&myjsonerr); // with &
}
┌----------------------------
| meta: errjson/examples/full.rs, line=45, function=main()
| ERR0001: Error when main() call myfnc()
| origin:
| ┌----------------------------
| | meta: errjson/examples/full.rs, line=29, function=myfnc()
| | ERR0002: Error when myfnc() call mysubfnc()
| | origin:
| | ┌----------------------------
| | | meta: errjson/examples/full.rs, line=12, function=mysubfnc()
| | | ERR003: Error when mysubfnc() call mysubsubfnc()
| | | origin:
| | | ┌----------------------------
| | | | std:error:Error: No such file or directory (os error 2)
Examples
cargo run --example basic
Dependencies
~0.8–1.7MB
~35K SLoC