Skip to content

Nice, colorful and simple error output

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

GoldsteinE/show-my-errors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

show-my-errors

License Version Build status

This is a library to display simple errors in colorful, rustc-like way. It can't show multi-line errors or draw arrows between parts of code, but its interface is simple and easy to use. If you want something more complex, you probably should use annotate-snippets, which is used by rustc itself.

example output

Basic usage

Entry point of this library is AnnotationList. You should create it, add some errors and then use .show_stderr() or .show_stdout() with some Stylesheet to display the message.

let mut list = AnnotationList::new("hello.txt", "Hello world!");
list
    .warning(4..7, "punctuation problem", "you probably forgot a comma")?
    .info(0..0, "consider adding some translations", None)?;
assert_eq!(list.to_string()?, r#"
warning: punctuation problem
  --> hello.txt:1:5
   |
 1 | Hello world!
   |     ^^^ you probably forgot a comma

info: consider adding some translations
  --> hello.txt:1:1
   |
 1 | Hello world!
   |
"#);

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

SPDX-License-Identifier: MIT OR Apache-2.0

About

Nice, colorful and simple error output

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages