miette
miette copied to clipboard
IntoDiagnostic hides original error from downcasting
Currently IntoDiagnostic
wraps the Error that it is called on with a DiagnosticError
.
https://github.com/zkat/miette/blob/e6f5cacfa65cfe26255a5686ceb610b4a211931b/src/eyreish/into_diagnostic.rs#L22-L26
This means that any further inspection using is
or downcast{,_ref,_mut}
will fail to reach the inner type and only DiagnosticError
can be reached. Since it is an implementation detail, I think it should be transparent to the user.
Maybe the downcast*
methods could additionally safeguard against DiagnosticError
and reach into it when encountering it?
Being able to downcast back to the original error sounds super handy! I don't know if I can do this any time soon, but I'll happily take a patch to add this if anyone's willing!