-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix: Clean up and decouple interledge-packet::ParseError in other crates #722
Conversation
011deda
to
bd3a168
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I think this looks very good; you updated it during my scan through, so some things might already be good to resolve.
There are some string nits; perhaps the biggest issue is with the changed messages. Are you sure those can change? I think I reverted some changes as well in the bytes 0.5 upgrade, so I'd be inclined to keep the external behaviour (the messages) as the same by default when refactoring.
Either way, I think at least the interledger-packet::Error
commits need a !
to signify a breaking change (since those at minimum are exported).
EDIT: thought about it a bit, expanded the I'd be inclined to keep the external behaviour (the messages) as the same by default when refactoring.
3246d40
to
54738fc
Compare
#[error("UTF-8 Error: {0}")] | ||
Utf8Err(#[from] Utf8Error), | ||
#[error("UTF-8 Conversion Error: {0}")] | ||
FromUtf8Err(#[from] FromUtf8Error), | ||
#[error("Chrono Error: {0}")] | ||
ChronoErr(#[from] chrono::ParseError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note for the follow-ups: I dont think there's any point in carrying this around either. If the timestamp isn't good it doesn't really matter how bad is it. I think chrono::ParseError is quite uninformative as well.
pub(crate) fn try_from_without_expiry(prepare: &Prepare) -> Result<Self, CcpPacketError> { | ||
let destination = prepare.destination(); | ||
if destination != *CCP_CONTROL_DESTINATION { | ||
return Err(CcpPacketError::UnexpectedDestination(destination)); | ||
} | ||
|
||
if prepare.execution_condition() != PEER_PROTOCOL_CONDITION { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting aside note: This check is duplicated along with it's log stmt... Probably not great to log and return an error but ok to clean this up later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is looking great! Much less format!(...)
.
As discussed the std::io::Error
will be gotten rid from interledger-packet/src/oer.rs
with a more specific simpler enum in a follow-up.
The latest |
Rerunning as the other one failed to start as well. |
Github actions is having issues, we'll need to restart later. |
Introduce TrailingBytesError, DataTypeError, PacketTypeError Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com> Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
ca4123c
to
e664d03
Compare
cc #708
This attempts to decouple the error type
ParseError
in interledger-packet with other crates.The idea is to have more explicit errors that are more efficient.