astroband / astrocore

Stellar-core implementation in Rust (WIP)
31 stars 5 forks source link

Wrap io and parse errors in Peer::receive_message #27

Closed charlie-wasp closed 5 years ago

charlie-wasp commented 5 years ago

Resolves #26 (I believe 😅 )

In this PR I wrapped io errors and serde parsing errors into one enum, it allows to eliminate panics from network errors in Peer::receive_message and handle errors consistently

Arkweid commented 5 years ago

Maybe rename short MsgRecvError to full variant MessageReceiveError? The same suggestion for TCP(std::io::Error), to something like BrokenFrame(std::io::Error). What do you think?

charlie-wasp commented 5 years ago

I thought, we're doing some cool system programming here, so we should choose incomprehensible short names 😅 Ok, I rename it

Talking about TCP: I think BrokenFrame would be misleading, because this kind of errors includes network level errors, e.g. connection reset