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

Commit 988e3cb

Browse files
committed
make subsystem errors more specific
1 parent caa22dd commit 988e3cb

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

node/core/av-store/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ mod columns {
5151
#[derive(Debug, Error)]
5252
enum Error {
5353
#[error(transparent)]
54-
Erasure(erasure::Error),
54+
Erasure(#[from]erasure::Error),
5555
#[error(transparent)]
56-
Io(io::Error),
56+
Io(#[from]io::Error),
5757
#[error(transparent)]
58-
Oneshot(oneshot::Canceled),
58+
Oneshot(#[from]oneshot::Canceled),
5959
#[error(transparent)]
60-
Subsystem(SubsystemError),
60+
Subsystem(#[from]SubsystemError),
6161
}
6262

6363
/// An implementation of the Availability Store subsystem.

node/core/backing/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ enum Error {
7373
CandidateNotFound,
7474
#[error("Signature is invalid")]
7575
InvalidSignature,
76-
#[error("Storing data was not successful")]
77-
StoreFailed,
78-
#[error(transparent)]
79-
Erasure(erasure_coding::Error),
76+
#[error("Storing data failed")]
77+
StoreFailed(oneshot::Canceled),
78+
#[error("Responding to backing request failed")]
79+
BackingResponseChannel(oneshot::Canceled),
80+
#[error("Obtaining erasure chunks failed")]
81+
ObtainErasureChunks(#[from] #[source]erasure_coding::Error),
8082
#[error(transparent)]
8183
ValidationFailed(ValidationFailed),
8284
#[error(transparent)]
83-
Oneshot(oneshot::Canceled),
84-
#[error(transparent)]
8585
Mpsc(mpsc::SendError),
8686
#[error(transparent)]
8787
UtilError(util::Error),
@@ -472,7 +472,7 @@ impl CandidateBackingJob {
472472
CandidateBackingMessage::GetBackedCandidates(_, tx) => {
473473
let backed = self.get_backed();
474474

475-
tx.send(backed).map_err(|_| oneshot::Canceled)?;
475+
tx.send(backed).map_err(|e| Error::BackingResponseChannel(e))?;
476476
}
477477
}
478478

@@ -643,7 +643,7 @@ impl CandidateBackingJob {
643643
)
644644
).await?;
645645

646-
rx.await?.map_err(|_| Error::StoreFailed)?;
646+
rx.await?.map_err(|e| Error::StoreFailed(e))?;
647647

648648
Ok(())
649649
}

0 commit comments

Comments
 (0)