pub enum RdapError {
Show 13 variants
InvalidInput(String),
SsrfBlocked {
url: String,
reason: String,
},
InsecureScheme {
scheme: String,
},
NoServerFound {
query: String,
},
BootstrapFetch {
resource: String,
source: Box<RdapError>,
},
Network(Error),
HttpStatus {
status: u16,
url: String,
},
Timeout {
millis: u64,
url: String,
},
ParseError {
reason: String,
},
MissingObjectClass,
UnknownObjectClass {
class: String,
},
Cache(String),
InvalidUrl {
url: String,
source: ParseError,
},
}Expand description
The unified error type for all rdapify operations.
§Examples
use rdap_types::RdapError;
fn handle(err: RdapError) {
match err {
RdapError::InvalidInput(msg) => eprintln!("Bad input: {msg}"),
RdapError::NoServerFound { query } => eprintln!("No RDAP server for: {query}"),
RdapError::Network(e) => eprintln!("Network error: {e}"),
_ => {}
}
}Variants§
InvalidInput(String)
The supplied domain name, IP address, or ASN is not valid.
SsrfBlocked
The resolved URL targets a private, loopback, or link-local address.
InsecureScheme
The URL scheme is not HTTPS.
NoServerFound
No RDAP server was found for the given TLD / IP range / ASN range.
BootstrapFetch
The IANA bootstrap file could not be fetched or parsed.
Network(Error)
A network-level error occurred (DNS, TCP, TLS, timeout).
HttpStatus
The RDAP server returned an HTTP error status.
Timeout
The request did not complete within the configured timeout.
ParseError
The response JSON could not be deserialized into a known RDAP type.
MissingObjectClass
The response is missing a required objectClassName field.
UnknownObjectClass
The response contains an objectClassName that this client does not
recognise.
Cache(String)
An internal cache operation failed (should be rare).
InvalidUrl
A URL could not be parsed.
Implementations§
Source§impl RdapError
impl RdapError
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Returns an HTTP-like status code for the error, suitable for surfacing through FFI or REST bindings.
Sourcepub fn is_invalid_input(&self) -> bool
pub fn is_invalid_input(&self) -> bool
Returns true if the error is caused by invalid user input.
Sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Returns true if the error is a network-level failure.
Sourcepub fn is_ssrf_blocked(&self) -> bool
pub fn is_ssrf_blocked(&self) -> bool
Returns true if the request was blocked by SSRF protection.
Trait Implementations§
Source§impl Error for RdapError
impl Error for RdapError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for RdapError
impl !RefUnwindSafe for RdapError
impl Send for RdapError
impl Sync for RdapError
impl Unpin for RdapError
impl UnsafeUnpin for RdapError
impl !UnwindSafe for RdapError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.