lerr

Crates.iolerr
lib.rslerr
version0.1.5
sourcesrc
created_at2023-09-13 21:56:57.859811
updated_at2023-09-17 10:30:37.506118
descriptionsimple errors for lang-dev
homepage
repositoryhttps://github.com/bend-n/lerr
max_upload_size
id971993
size34,888
bendn (bend-n)

documentation

README

lerr

extremely barebones error diagnostics for lang-dev

example error

usage

heres the code for the sample above. feel free to add coloring with your favorite coloring crate, or just use raw ansi sequences.

use comat::cformat as cmt;
use lerr::Error;
let mut e = Error::new("Strin::nouveau().i_like_tests(3.14158)");
e.message(cmt!(r#"{bold_red}error{reset}: unknown function {bold_red}String::new(){reset}"#))
    .label((0..5, cmt!("you probably meant {black}String{reset}")))
    .label((7..16, cmt!("use {green}new(){reset}")))
    .label((17..18, cmt!("caps: {bold_cyan}I{reset}")))
    .label((30..37, cmt!("your {bold_yellow}π{reset} is bad")));
eprintln!("{e}");

Please note that multiline labels are not yet supported. If that doesnt work for you, use something like ariadne.

Commit count: 10

cargo fmt