-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move BoxError downcast out of impl From<BoxError> for TransactionError
#5732
Comments
These downcasts are located in the same place, so we don't accidentally implement conflicting downcasts. Moving the downcasts out of the conversion could make the code harder to maintain, and create more bugs.
Unfortunately, it is impossible to know the type of many errors, because Before we can prioritise or estimate this ticket, it will need a specific design that takes these issues into account. |
Ah, I see. Still, it might be a good idea to do the conversion outside a |
I don't think the design in the ticket does this? |
My wording there may have been a bit vague, it's more to disallow using It might also be nice to annotate where each type is expected. |
I think we can use concrete types, rather than comments, so the compiler can check them. I've added this as a TODO in the code, so we do it when we're rewriting that error handling. |
Motivation
It would be better for the compiler to complain about a mismatch between BoxError / TransactionError when using the
?
operator, and to perform the conversions where the type ofBoxError
is more explicitly known.TransactionError
is currently the only error type with aFrom
impl handling downcasts.This could be used in the block verifier for
VerifyBlockError::ValidateProposal
as well if defined in a trait.Possible Design
Related Work
The text was updated successfully, but these errors were encountered: