#error #error-chain

myutil

A simple and friendly error-chain

636 releases

new 0.2.652 Oct 19, 2020
0.2.651 Oct 19, 2020
0.2.7 Sep 23, 2020

#72 in Debugging

Download history 76/week @ 2020-09-01 8/week @ 2020-09-08 13/week @ 2020-09-15 28/week @ 2020-09-22 31/week @ 2020-09-29 18/week @ 2020-10-06 8155/week @ 2020-10-13

2,550 downloads per month
Used in less than 12 crates

MIT license

13KB
380 lines

myutil

A simple and friendly error-chain, with many useful utils as an addition.

The painful experience of using error-chain gave birth to this project. It can adapt to almost all scenes without any special implementation.

Usage

Tips: you can easily implement your own Error.

use myutil::{err::*, *};

fn will_panic() {
    let l1 = || -> Result<()> { Err(eg!("error!")) };
    let l2 = || -> Result<()> { l1().c(d!()) };
    let l3 = || -> Result<()> { l2().c(d!()) };
    let l4 = || -> Result<()> { l3().c(d!()) };

    pnk!(l4());
}

OutPut Sample

000000 [pidns: NULL][pid: 46574] 2020-09-06 18:18:32
Error:
├── file: src/lib.rs
└── line: 318
Caused By:
├── file: src/lib.rs
└── line: 316
    Caused By:
    ├── file: src/lib.rs
    └── line: 314
        Caused By:
        ├── file: src/lib.rs
        └── line: 312
            Caused By: Some error occur!
            ├── file: src/lib.rs
            └── line: 310

Dependencies

~0.8–1.2MB
~29K SLoC