#[non_exhaustive]pub enum LoopsError {
Api {
message: String,
status: Option<u16>,
body: Option<Value>,
},
InvalidInput(String),
Configuration(String),
ContactExists {
message: String,
},
UnsafeEmail {
email: String,
allowed_domains: Vec<String>,
},
RateLimit {
limit: u64,
remaining: u64,
},
Http(Error),
Decode {
action: &'static str,
status: u16,
source: Box<dyn StdError + Send + Sync>,
},
}Expand description
Every way a LoopsClient call can fail.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Api
Loops answered with a failure status, or with a body this SDK did not expect.
Fields
InvalidInput(String)
The arguments were rejected before any request was sent.
Configuration(String)
The client is missing configuration it needs, such as an API key.
ContactExists
create_contact found a contact with the same email or user ID (HTTP 409).
UnsafeEmail
Safe mode is on and the address is outside the allowed domains.
Fields
RateLimit
Loops rate-limited the request (HTTP 429).
Fields
Http(Error)
The request could not be sent or its response could not be read.
Decode
A success response did not match the shape the OpenAPI spec promises.
Implementations§
Source§impl LoopsError
impl LoopsError
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
The HTTP status code tied to this error, when there is one.
Sourcepub fn response_body(&self) -> Option<&Value>
pub fn response_body(&self) -> Option<&Value>
The JSON body Loops answered a failed request with, when there is one.
Trait Implementations§
Source§impl Debug for LoopsError
impl Debug for LoopsError
Source§impl Display for LoopsError
impl Display for LoopsError
Source§impl Error for LoopsError
impl Error for LoopsError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for LoopsError
impl !UnwindSafe for LoopsError
impl Freeze for LoopsError
impl Send for LoopsError
impl Sync for LoopsError
impl Unpin for LoopsError
impl UnsafeUnpin for LoopsError
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
Mutably borrows from an owned value. Read more
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> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
Source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
Source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
Source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP