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:
Henry de Valence 2020-02-07 21:56:59 -08:00
parent 29f901add3
commit 2082672b3c
2 changed files with 1 additions and 20 deletions

View File

@ -408,11 +408,6 @@ where
match rsp { match rsp {
Response::Nil => { /* generic success, do nothing */ } 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) => { Response::Peers(addrs) => {
if let Err(e) = self.peer_tx.send(Message::Addr(addrs)).await { if let Err(e) = self.peer_tx.send(Message::Addr(addrs)).await {
self.fail_with(e.into()); self.fail_with(e.into());

View File

@ -1,5 +1,3 @@
use std::error::Error;
// XXX clean module layout of zebra_chain // XXX clean module layout of zebra_chain
use zebra_chain::block::Block; use zebra_chain::block::Block;
@ -11,21 +9,9 @@ pub enum Response {
/// A response with no data. /// A response with no data.
Nil, Nil,
/// Generic error.
Error,
/// A list of peers, used to respond to `GetPeers`. /// A list of peers, used to respond to `GetPeers`.
Peers(Vec<MetaAddr>), Peers(Vec<MetaAddr>),
/// A list of blocks. /// A list of blocks.
Blocks(Vec<Block>), Blocks(Vec<Block>),
} }
impl<E> From<E> for Response
where
E: Error,
{
fn from(_e: E) -> Self {
Self::Error
}
}