Skip to content

๐Ÿง™โ€โ™€๏ธ๐Ÿ”ฎ a magical type for displaying source file errors

License

Notifications You must be signed in to change notification settings

softprops/source-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง™โ€โ™€๏ธ๐Ÿ”ฎ

source-error

a magical type for displaying source file errors


๐Ÿ“ฆ install

Add the following to your Cargo.toml file's [dependencies] heading

[dependencies]
source-error = "0.1"

๐Ÿคธ usage

๐Ÿšง Interfaces are not yet finalized and are subject to change

This crate is intended as a visual reporting diagnostic for tools which operate on text sources.

The source_error::Error type provides a helpful Display and can be used on in any Error context

use source_error::{from_file, Position};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    println!(
        "{}",
        from_file(
            "whoopsie!",
            "path/to/some/file.json",
            Position::new(3, 4)
        )?
    );
    Ok(())
}

Doug Tangren (softprops) 2019

About

๐Ÿง™โ€โ™€๏ธ๐Ÿ”ฎ a magical type for displaying source file errors

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages