pub enum ZeroTrustError {
Show 16 variants
ApiError(Error),
SerializationError(Error),
IoError(Error),
DatabaseError(Error),
ConfigError(String),
AuthError(String),
ValidationError(String),
MigrationError(String),
SyncError(String),
Timeout,
ServerError {
status: u16,
message: String,
},
ClientError {
status: u16,
message: String,
},
NotFound {
resource: String,
},
PermissionDenied {
operation: String,
},
RateLimitExceeded {
retry_after: u64,
},
Generic(String),
}
Expand description
Main error type for the Zero Trust SDK
Variants§
ApiError(Error)
HTTP request errors
SerializationError(Error)
JSON serialization/deserialization errors
IoError(Error)
IO errors
DatabaseError(Error)
Database errors (when migration feature is enabled)
ConfigError(String)
Configuration errors
AuthError(String)
Authentication errors
ValidationError(String)
Validation errors
MigrationError(String)
Migration errors
SyncError(String)
Sync errors
Timeout
Network timeout
ServerError
Server errors (5xx)
ClientError
Client errors (4xx)
NotFound
Resource not found
PermissionDenied
Permission denied
RateLimitExceeded
Rate limit exceeded
Generic(String)
Generic error
Implementations§
Source§impl ZeroTrustError
impl ZeroTrustError
Sourcepub fn validation<S: Into<String>>(message: S) -> Self
pub fn validation<S: Into<String>>(message: S) -> Self
Create a new validation error
Sourcepub fn permission_denied<S: Into<String>>(operation: S) -> Self
pub fn permission_denied<S: Into<String>>(operation: S) -> Self
Create a new permission denied error
Sourcepub fn server_error(status: u16, message: String) -> Self
pub fn server_error(status: u16, message: String) -> Self
Create a server error from HTTP status and message
Sourcepub fn client_error(status: u16, message: String) -> Self
pub fn client_error(status: u16, message: String) -> Self
Create a client error from HTTP status and message
Sourcepub fn rate_limit(retry_after: u64) -> Self
pub fn rate_limit(retry_after: u64) -> Self
Create a rate limit error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this is a retryable error
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Check if this is an authentication error
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if this is a client error (user’s fault)
Trait Implementations§
Source§impl Debug for ZeroTrustError
impl Debug for ZeroTrustError
Source§impl Display for ZeroTrustError
impl Display for ZeroTrustError
Source§impl Error for ZeroTrustError
impl Error for ZeroTrustError
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()
Source§impl From<DecodeError> for ZeroTrustError
impl From<DecodeError> for ZeroTrustError
Source§fn from(err: DecodeError) -> Self
fn from(err: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<Error> for ZeroTrustError
impl From<Error> for ZeroTrustError
Source§impl From<Error> for ZeroTrustError
impl From<Error> for ZeroTrustError
Source§impl From<Error> for ZeroTrustError
impl From<Error> for ZeroTrustError
Source§impl From<Error> for ZeroTrustError
impl From<Error> for ZeroTrustError
Auto Trait Implementations§
impl Freeze for ZeroTrustError
impl !RefUnwindSafe for ZeroTrustError
impl Send for ZeroTrustError
impl Sync for ZeroTrustError
impl Unpin for ZeroTrustError
impl !UnwindSafe for ZeroTrustError
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more