Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
make subsystem errors more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
drahnr committed Oct 22, 2020
1 parent caa22dd commit 988e3cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions node/core/av-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ mod columns {
#[derive(Debug, Error)]
enum Error {
#[error(transparent)]
Erasure(erasure::Error),
Erasure(#[from]erasure::Error),
#[error(transparent)]
Io(io::Error),
Io(#[from]io::Error),
#[error(transparent)]
Oneshot(oneshot::Canceled),
Oneshot(#[from]oneshot::Canceled),
#[error(transparent)]
Subsystem(SubsystemError),
Subsystem(#[from]SubsystemError),
}

/// An implementation of the Availability Store subsystem.
Expand Down
16 changes: 8 additions & 8 deletions node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ enum Error {
CandidateNotFound,
#[error("Signature is invalid")]
InvalidSignature,
#[error("Storing data was not successful")]
StoreFailed,
#[error(transparent)]
Erasure(erasure_coding::Error),
#[error("Storing data failed")]
StoreFailed(oneshot::Canceled),
#[error("Responding to backing request failed")]
BackingResponseChannel(oneshot::Canceled),
#[error("Obtaining erasure chunks failed")]
ObtainErasureChunks(#[from] #[source]erasure_coding::Error),
#[error(transparent)]
ValidationFailed(ValidationFailed),
#[error(transparent)]
Oneshot(oneshot::Canceled),
#[error(transparent)]
Mpsc(mpsc::SendError),
#[error(transparent)]
UtilError(util::Error),
Expand Down Expand Up @@ -472,7 +472,7 @@ impl CandidateBackingJob {
CandidateBackingMessage::GetBackedCandidates(_, tx) => {
let backed = self.get_backed();

tx.send(backed).map_err(|_| oneshot::Canceled)?;
tx.send(backed).map_err(|e| Error::BackingResponseChannel(e))?;
}
}

Expand Down Expand Up @@ -643,7 +643,7 @@ impl CandidateBackingJob {
)
).await?;

rx.await?.map_err(|_| Error::StoreFailed)?;
rx.await?.map_err(|e| Error::StoreFailed(e))?;

Ok(())
}
Expand Down

0 comments on commit 988e3cb

Please sign in to comment.