Skip to content

qyuzh/anyhow-loc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anyhow location

Error with location

use anyhow_loc::{msg, ErrorLocation};

fn f() -> anyhow::Result<()> {
    anyhow::bail!("oh no!");
}

fn main() -> anyhow::Result<()> {
    let t = String::from("error 2");
    f().with_location(|| msg!("error")) // sep
        .with_location(|| msg!("{}", t))?;
    Ok(())
}

Output

Error: error 2 
 at examples/basic.rs:10

Caused by:
    0: error 
        at examples/basic.rs:9
    1: oh no!

Releases

No releases published

Packages

No packages published

Languages