Improve diagnostics from SerializationError
s
#758
Labels
A-rust
Area: Updates to Rust code
C-cleanup
Category: This is a cleanup
E-help-wanted
Call for participation: Help is requested to fix this issue.
good first issue
Right now our serialization error uses some fairly generic error variants that don't include enough context. For example, recently I ran into a bug in tests for
zebra-state
where the error was particularly unhelpfulSo I tweaked the
SerializationError
type to use a more useful error message and include extra context about what it was trying to deserialize:By making the following changes:
followed by a ton of this throughout the code
However, these changes were very invasive and I ran into some issues with
impl Decoder
inzebra-network
where we're using SerializationError as our error kind and fixing it appropriately was more of a yak shave than I wanted to get into.Long term we should probably refine these error types. We should probably rename
SerializationError
toDeserializationError
as it is only the error return type forZcashDeserialize
. We should look into giving more context for why a serialization error was thrown, the solution that adds a static str to put the type name in has the advantage of requiring that the context is provided via compiler errors, but its not ideal ergonomically, if we can find a way to require instrumention on all of our deserialize impls it might be better to useSpanTrace
to capture the context about what is being deserialized.For codec we should introduce our own error kind, us implicitly constructing a
DeserializeError::Io
from errors originating in the tokio codec upstream code misrepresents the meaning of the Io error, which likely has nothing to do with deserialization.The text was updated successfully, but these errors were encountered: