more strict nuon handling, better nuon errors (#4576)

* more strict nuon handling, better nuon errors

* Improve errors a bit more
This commit is contained in:
JT
2022-02-20 22:31:50 -05:00
committed by GitHub
parent 5befa6f80a
commit a96f8b891e
9 changed files with 485 additions and 86 deletions

View File

@ -13,7 +13,7 @@ nu-ansi-term = "0.42.0"
nu-color-config = { path = "../nu-color-config" }
miette = { version = "3.0.0", features = ["fancy"] }
miette = { version = "4.1.0", features = ["fancy"] }
thiserror = "1.0.29"
reedline = { git = "https://github.com/nushell/reedline", branch = "main" }

View File

@ -41,6 +41,14 @@ impl<'src> miette::Diagnostic for CliError<'src> {
// Finally, we redirect the source_code method to our own source.
fn source_code(&self) -> Option<&dyn SourceCode> {
Some(&self.1)
if let Some(source_code) = self.0.source_code() {
Some(source_code)
} else {
Some(&self.1)
}
}
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn miette::Diagnostic> + 'a>> {
self.0.related()
}
}