Remove Response::Error.
Error handling is already handled by Result; we don't need an "inner" error variant duplicating the outer one.
This commit is contained in:
parent
29f901add3
commit
2082672b3c
|
@ -408,11 +408,6 @@ where
|
|||
|
||||
match rsp {
|
||||
Response::Nil => { /* generic success, do nothing */ }
|
||||
Response::Error => {
|
||||
if let Err(e) = self.peer_tx.send(Message::from(PeerError::Rejected)).await {
|
||||
self.fail_with(e.into());
|
||||
}
|
||||
}
|
||||
Response::Peers(addrs) => {
|
||||
if let Err(e) = self.peer_tx.send(Message::Addr(addrs)).await {
|
||||
self.fail_with(e.into());
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::error::Error;
|
||||
|
||||
// XXX clean module layout of zebra_chain
|
||||
use zebra_chain::block::Block;
|
||||
|
||||
|
@ -11,21 +9,9 @@ pub enum Response {
|
|||
/// A response with no data.
|
||||
Nil,
|
||||
|
||||
/// Generic error.
|
||||
Error,
|
||||
|
||||
/// A list of peers, used to respond to `GetPeers`.
|
||||
Peers(Vec<MetaAddr>),
|
||||
|
||||
/// A list of blocks.
|
||||
Blocks(Vec<Block>),
|
||||
}
|
||||
|
||||
impl<E> From<E> for Response
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
fn from(_e: E) -> Self {
|
||||
Self::Error
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue