Skip to content

Commit

Permalink
improve serialization error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed Sep 20, 2024
1 parent 2bb385b commit 023dda2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/types/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ impl<TYPES: NodeType, V: Versions> UpgradeLock<TYPES, V> {
// Associated constants cannot be used in pattern matches, so we do this trick instead.
v if v == V::Base::VERSION => Serializer::<V::Base>::serialize(&message),
v if v == V::Upgrade::VERSION => Serializer::<V::Upgrade>::serialize(&message),
_ => {
bail!("Attempted to serialize with an incompatible version. This should be impossible.");
v => {
bail!("Attempted to serialize with version {}, which is incompatible. This should be impossible.", v);
}
};

Expand All @@ -491,8 +491,8 @@ impl<TYPES: NodeType, V: Versions> UpgradeLock<TYPES, V> {
let deserialized_message: M = match actual_version {
v if v == V::Base::VERSION => Serializer::<V::Base>::deserialize(message),
v if v == V::Upgrade::VERSION => Serializer::<V::Upgrade>::deserialize(message),
_ => {
bail!("Cannot deserialize message!");
v => {
bail!("Cannot deserialize message with stated version {}", v);
}
}
.context("Failed to deserialize message!")?;
Expand Down

0 comments on commit 023dda2

Please sign in to comment.