You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.
Compat should override method source() to something like return self.cause().compat().
That way, the chain of causes of the Fail would be visible from code expecting the standard Error trait.
The text was updated successfully, but these errors were encountered:
I've also noticed it „loses“ the sources when going through compat.
However, I think the problem is that it returns Option<&dyn Error>. That means, it can't create the Compat on stack and return it, it would have to contain it in itself, which it probably doesn't. It can't reference thin air :-(.
I'm still trying to think of a hacky way to work around this (somewhat in direction of making Compat#[repr(transparent)] and do some clever transmuting, but the dyns there seem to pose problems there; I'm not sure this would be worth it even if it worked).
Other option would be to create a Vec of some Compat-like structs that would wrap the &dyn Errors and return these and let them delegate. This would still be problematic because such thing would be effectively a self-referencing structure and it would make the top-level Compat a bit more expensive to create, but I'm confident this could be beaten long enough to actually make it work (also with unsafe, though). Again, I'm not sure if it's worth it.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Compat
should override methodsource()
to something likereturn self.cause().compat()
.That way, the chain of causes of the
Fail
would be visible from code expecting the standardError
trait.The text was updated successfully, but these errors were encountered: