Open seanmonstar opened 2 months ago
Came across this myself today. I expected that I could massage the Anyhow boxed error back into an anyhow::Error
but that also doesn't work.
Naively, I thought the from_boxed
1 could check to see if the Boxed error is an ErrorImpl, but it can't since object_boxed
revives the erased type before boxing2
When I have an
anyhow::Error
and convert that into aBox<dyn std::error::Error>
, it seems that I can no longer downcast it back into anything (neitheranyhow::Error
nor the original error type). This differs from the behavior of casting the anyhow error to a&(dyn StdError + 'static)
, which does still allow downcasting to the orignal type.Perhaps this is a limitation that cannot be solved, but I couldn't find it documented so I wasn't sure if it was known.