Crates.io | printjsonerr |
lib.rs | printjsonerr |
version | 0.0.1 |
source | src |
created_at | 2023-05-14 20:10:33.062671 |
updated_at | 2023-05-14 20:10:33.062671 |
description | print json err |
homepage | |
repository | https://codeberg.org/AlbanMinassian/errorjson |
max_upload_size | |
id | 864458 |
size | 22,047 |
printjsonerr help to print json error
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)
cargo run --example basic