1 unstable release
0.0.1 | May 14, 2023 |
---|
#18 in #json-error
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.7–1.5MB
~33K SLoC