use std::net::AddrParseError;
use std::num::ParseIntError;
use thiserror::Error;
#[derive(Clone, Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("Invalid GeoIP data file: {0}")]
BadFormat(&'static str),
#[error("Unsupported country code in file: {0}")]
BadCountryCode(String),
#[error("The 'nowhere' country code ('??') is not supported in this context.")]
NowhereNotSupported,
}
impl From<ParseIntError> for Error {
fn from(_e: ParseIntError) -> Error {
Error::BadFormat("can't parse number")
}
}
impl From<AddrParseError> for Error {
fn from(_e: AddrParseError) -> Error {
Error::BadFormat("can't parse IPv6 address")
}
}