Add links to the user-manual to errors, when applicable.

This commit is contained in:
KtorZ
2022-12-23 19:50:14 +01:00
parent 69f060e675
commit 7b9ea5dabb
2 changed files with 120 additions and 3 deletions

View File

@@ -368,6 +368,27 @@ impl Diagnostic for Error {
Error::JoinError(_) => None,
}
}
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>> {
match self {
Error::DuplicateModule { .. } => None,
Error::FileIo { .. } => None,
Error::ImportCycle { .. } => None,
Error::List { .. } => None,
Error::Parse { .. } => None,
Error::Type { error, .. } => error.url(),
Error::StandardIo(_) => None,
Error::MissingManifest { .. } => None,
Error::TomlLoading { .. } => None,
Error::Format { .. } => None,
Error::ValidatorMustReturnBool { .. } => None,
Error::WrongValidatorArity { .. } => None,
Error::TestFailure { .. } => None,
Error::Http { .. } => None,
Error::ZipExtract { .. } => None,
Error::JoinError { .. } => None,
}
}
}
#[derive(thiserror::Error)]