abuse-contact 0.1.0

Find the abuse contact for an IP address or a domain name
Documentation
//! Error types for the crate.

/// A value that cannot be used as a query or as a result.
///
/// These come from the constructors of the newtypes in this crate. A lookup that is
/// certain to fail never reaches the network, and a placeholder a registry sends in
/// place of a real address never reaches the caller.
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum ValidationError {
    /// The domain name was empty.
    #[error("the domain name is empty. Give a name such as \"example.com\"")]
    EmptyDomain,

    /// The domain name was not shaped like a domain name.
    #[error("\"{value}\" is not a domain name: {problem}")]
    InvalidDomain {
        /// The rejected value.
        value: String,
        /// What is wrong with it.
        problem: &'static str,
    },

    /// The email address was not shaped like an email address.
    #[error("\"{value}\" is not an email address: {problem}")]
    InvalidEmail {
        /// The rejected value.
        value: String,
        /// What is wrong with it.
        problem: &'static str,
    },

    /// A source sent a fixed address that stands for "no contact published".
    ///
    /// A regional registry that withholds the contact of a network answers with one
    /// address for every network in the region. The address is a marker, not a
    /// mailbox that reads reports.
    #[error(
        "\"{value}\" is the address a source returns when it has no contact for the \
         network, not a contact. Ask the regional registry, or use the technical \
         contact from RDAP"
    )]
    WithheldEmail {
        /// The marker the source sent.
        value: String,
    },

    /// The registry sent a placeholder in place of an address.
    ///
    /// A registry that hides contact data puts a fixed string such as
    /// `DATA REDACTED` in the field. The string is not an address and must not be
    /// used as one.
    #[error(
        "\"{value}\" is a placeholder the registry sends in place of an address, \
         not an address. Look for the abuse contact of the network instead"
    )]
    RedactedEmail {
        /// The placeholder the registry sent.
        value: String,
    },
}