Skip to content

Commit

Permalink
feat: improve error output on compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaka91 committed Oct 24, 2023
1 parent f3e0ced commit bd15eba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/stef-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use std::{
convert::AsRef,
fmt::Debug,
path::{Path, PathBuf},
};

Expand All @@ -20,7 +21,7 @@ mod encode;

pub type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Debug, Error)]
#[derive(Error)]
pub enum Error {
#[error("failed to parse the glob pattern {glob:?}")]
Pattern {
Expand All @@ -45,6 +46,12 @@ pub enum Error {
Compile { report: Report, file: PathBuf },
}

impl Debug for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{self}")
}
}

pub fn compile(schemas: &[impl AsRef<str>], _includes: &[impl AsRef<Path>]) -> Result<()> {
miette::set_hook(Box::new(|_| {
Box::new(
Expand Down

0 comments on commit bd15eba

Please sign in to comment.