Skip to content

Commit

Permalink
fix(error): point to the correct variant on the docs url
Browse files Browse the repository at this point in the history
  • Loading branch information
ManicMarrc committed Oct 16, 2023
1 parent 2450afc commit 5ea444b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ impl Diagnostic for MietteError {

fn url<'a>(&'a self) -> Option<Box<dyn fmt::Display + 'a>> {
let crate_version = env!("CARGO_PKG_VERSION");
let variant = match self {
MietteError::IoError(_) => "#variant.IoError",
MietteError::OutOfBounds => "#variant.OutOfBounds",
};
Some(Box::new(format!(
"https://docs.rs/miette/{}/miette/enum.MietteError.html",
crate_version,
"https://docs.rs/miette/{}/miette/enum.MietteError.html{}",
crate_version, variant,
)))
}
}

0 comments on commit 5ea444b

Please sign in to comment.