-
Hi! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you're willing to do a wrapper, you could use something like this, if I understand what you're asking for: struct WrapperErr(MyErrEnum);
impl trait miette::Diagnostic for WrapperErr {
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>> {
let extra_help = "For more help please check out our documentation at https://github.com/example/example";
if let Some(help) = self.0.help() {
Some(Box::new(format!("{help}\n\n{extra_help}")))
} else {
Some(Box::new(extra_help))
}
}
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>> {
self.0.code()
}
fn severity(&self) -> Option<miette::Severity> {
self.0.severity()
}
// ... etc, for all other protocol methods.
} |
Beta Was this translation helpful? Give feedback.
If you're willing to do a wrapper, you could use something like this, if I understand what you're asking for: