Move NetworkValidationError within file
Done in preparation for adding the `NetworkValidationError` as a variant of `ParseError`. Move the `NetworkValidationError` type to beneath `ParseError`. Code move only, no other changes.
This commit is contained in:
parent
c211e7be78
commit
d5c52618a9
|
@ -9,26 +9,6 @@ use crate::blockdata::script::{witness_program, witness_version};
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::Network;
|
use crate::Network;
|
||||||
|
|
||||||
/// Address's network differs from required one.
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct NetworkValidationError {
|
|
||||||
/// Network that was required.
|
|
||||||
pub(crate) required: Network,
|
|
||||||
/// The address itself.
|
|
||||||
pub(crate) address: Address<NetworkUnchecked>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for NetworkValidationError {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "address ")?;
|
|
||||||
fmt::Display::fmt(&self.address.0, f)?;
|
|
||||||
write!(f, " is not valid on {}", self.required)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
impl std::error::Error for NetworkValidationError {}
|
|
||||||
|
|
||||||
/// Error while generating address from script.
|
/// Error while generating address from script.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
@ -228,6 +208,26 @@ impl std::error::Error for UnknownHrpError {
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Address's network differs from required one.
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct NetworkValidationError {
|
||||||
|
/// Network that was required.
|
||||||
|
pub(crate) required: Network,
|
||||||
|
/// The address itself.
|
||||||
|
pub(crate) address: Address<NetworkUnchecked>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for NetworkValidationError {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "address ")?;
|
||||||
|
fmt::Display::fmt(&self.address.0, f)?;
|
||||||
|
write!(f, " is not valid on {}", self.required)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
impl std::error::Error for NetworkValidationError {}
|
||||||
|
|
||||||
/// Decoded base58 data was an invalid length.
|
/// Decoded base58 data was an invalid length.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct InvalidBase58PayloadLengthError {
|
pub struct InvalidBase58PayloadLengthError {
|
||||||
|
|
Loading…
Reference in New Issue