Open rydrman opened 11 months ago
After some digging in the codebase, it seems like forward(0)
already exists to handle this case, perhaps this can be added to the documentation?
#[derive(miette::Diagnostic, thiserror::Error, Debug)]
#[diagnostic(url("http://mylib.example"))]
enum Error {
#[error(transparent)]
#[diagnostic(forward(0)]
External(#[from] external::Error),
}
mod external {
#[derive(miette::Diagnostic, thiserror::Error, Debug)]
#[error("external error")]
pub struct Error;
}
It seems like you cannot mix
transparent
with any enum-level attributes, eg:results in
error: diagnostic(transparent) not allowed in combination with other args
I believe that I understand how this error is coming to pass, but in my case of having my library split among multiple crates, and my error enums being quite long it seems like too much to replicate the enum-level attributes for all other variants.
In this case, I think it would be reasonable to ignore the enum-level attributes for any variant that uses
transparent
, or maybe there's some alternate syntax or feature that I am missing for this case?