feat: add Error::ChannelClosed() variant to detect thread hangups

This commit is contained in:
Jude Nelson
2022-10-10 15:36:57 -04:00
parent dc58cfc7b4
commit b5e7ee553c

View File

@@ -121,6 +121,7 @@ pub enum Error {
PoxNoRewardCycle,
ProblematicTransaction(Txid),
MinerAborted,
ChannelClosed(String),
}
impl From<marf_error> for Error {
@@ -197,6 +198,7 @@ impl fmt::Display for Error {
txid
),
Error::MinerAborted => write!(f, "Mining attempt aborted by signal"),
Error::ChannelClosed(ref s) => write!(f, "Channel '{}' closed", s),
}
}
}
@@ -232,6 +234,7 @@ impl error::Error for Error {
Error::StacksTransactionSkipped(ref _r) => None,
Error::ProblematicTransaction(ref _txid) => None,
Error::MinerAborted => None,
Error::ChannelClosed(ref _s) => None,
}
}
}
@@ -267,6 +270,7 @@ impl Error {
Error::StacksTransactionSkipped(ref _r) => "StacksTransactionSkipped",
Error::ProblematicTransaction(ref _txid) => "ProblematicTransaction",
Error::MinerAborted => "MinerAborted",
Error::ChannelClosed(ref _s) => "ChannelClosed",
}
}