Crate source_error

Source
Expand description

A magical type for displaying source file errors

§example

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

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

Structs§

Error
An Error type targetting errors tied to source file contents
Position
Line and column coordinates

Functions§

from_file
Creates an Error with a message and path to source file a along with the relative position of the error
from_lines
Creates an Error with a message, path to source file a and source lines along with the relative position of the error