Remove deprecated std::error::Error::description
This commit is contained in:
parent
5373428510
commit
d02318f423
|
@ -91,17 +91,22 @@ pub enum Error {
|
|||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Error::Io(ref e) => fmt::Display::fmt(e, f),
|
||||
Error::ByteOrder(ref e) => fmt::Display::fmt(e, f),
|
||||
Error::Psbt(ref e) => fmt::Display::fmt(e, f),
|
||||
Error::UnexpectedNetworkMagic { expected: ref e, actual: ref a } => write!(f, "{}: expected {}, actual {}", error::Error::description(self), e, a),
|
||||
Error::OversizedVectorAllocation { requested: ref r, max: ref m } => write!(f, "{}: requested {}, maximum {}", error::Error::description(self), r, m),
|
||||
Error::InvalidChecksum { expected: ref e, actual: ref a } => write!(f, "{}: expected {}, actual {}", error::Error::description(self), e[..].to_hex(), a[..].to_hex()),
|
||||
Error::UnknownNetworkMagic(ref m) => write!(f, "{}: {}", error::Error::description(self), m),
|
||||
Error::ParseFailed(ref e) => write!(f, "{}: {}", error::Error::description(self), e),
|
||||
Error::UnsupportedSegwitFlag(ref swflag) => write!(f, "{}: {}", error::Error::description(self), swflag),
|
||||
Error::UnrecognizedNetworkCommand(ref nwcmd) => write!(f, "{}: {}", error::Error::description(self), nwcmd),
|
||||
Error::UnexpectedHexDigit(ref d) => write!(f, "{}: {}", error::Error::description(self), d),
|
||||
Error::Io(ref e) => write!(f, "I/O error: {}", e),
|
||||
Error::ByteOrder(ref e) => write!(f, "byteorder error: {}", e),
|
||||
Error::Psbt(ref e) => write!(f, "PSBT error: {}", e),
|
||||
Error::UnexpectedNetworkMagic { expected: ref e, actual: ref a } => write!(f,
|
||||
"unexpected network magic: expected {}, actual {}", e, a),
|
||||
Error::OversizedVectorAllocation { requested: ref r, max: ref m } => write!(f,
|
||||
"allocation of oversized vector: requested {}, maximum {}", r, m),
|
||||
Error::InvalidChecksum { expected: ref e, actual: ref a } => write!(f,
|
||||
"invalid checksum: expected {}, actual {}", e.to_hex(), a.to_hex()),
|
||||
Error::UnknownNetworkMagic(ref m) => write!(f, "unknown network magic: {}", m),
|
||||
Error::ParseFailed(ref e) => write!(f, "parse failed: {}", e),
|
||||
Error::UnsupportedSegwitFlag(ref swflag) => write!(f,
|
||||
"unsupported segwit version: {}", swflag),
|
||||
Error::UnrecognizedNetworkCommand(ref nwcmd) => write!(f,
|
||||
"unrecognized network command: {}", nwcmd),
|
||||
Error::UnexpectedHexDigit(ref d) => write!(f, "unexpected hex digit: {}", d),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,19 +129,7 @@ impl error::Error for Error {
|
|||
}
|
||||
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
Error::Io(ref e) => e.description(),
|
||||
Error::ByteOrder(ref e) => e.description(),
|
||||
Error::Psbt(ref e) => e.description(),
|
||||
Error::UnexpectedNetworkMagic { .. } => "unexpected network magic",
|
||||
Error::OversizedVectorAllocation { .. } => "allocation of oversized vector requested",
|
||||
Error::InvalidChecksum { .. } => "invalid checksum",
|
||||
Error::UnknownNetworkMagic(..) => "unknown network magic",
|
||||
Error::ParseFailed(..) => "parse failed",
|
||||
Error::UnsupportedSegwitFlag(..) => "unsupported segwit version",
|
||||
Error::UnrecognizedNetworkCommand(..) => "unrecognized network command",
|
||||
Error::UnexpectedHexDigit(..) => "unexpected hex digit",
|
||||
}
|
||||
"Bitcoin encoding error"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue