pub enum FilesError {
Show 18 variants
Request(Error),
BadRequest {
message: String,
field: Option<String>,
},
AuthenticationFailed {
message: String,
auth_type: Option<String>,
},
Forbidden {
message: String,
resource: Option<String>,
},
NotFound {
message: String,
resource_type: Option<String>,
path: Option<String>,
},
Conflict {
message: String,
resource: Option<String>,
},
PreconditionFailed {
message: String,
condition: Option<String>,
},
UnprocessableEntity {
message: String,
field: Option<String>,
value: Option<String>,
},
Locked {
message: String,
resource: Option<String>,
},
RateLimited {
message: String,
retry_after: Option<u64>,
},
InternalServerError {
message: String,
request_id: Option<String>,
},
ServiceUnavailable {
message: String,
retry_after: Option<u64>,
},
ApiError {
code: u16,
message: String,
endpoint: Option<String>,
},
ConfigError(String),
JsonError(Error),
JsonPathError {
path: String,
source: Error,
},
IoError(String),
UrlParseError(ParseError),
}
Expand description
Errors that can occur when using the Files.com API
Each error variant includes contextual information to help with debugging and provide meaningful error messages to users.
Variants§
Request(Error)
HTTP request failed
BadRequest
Bad Request (400) - Invalid parameters or malformed request
AuthenticationFailed
Authentication failed (401)
Forbidden
Forbidden (403) - Valid credentials but insufficient permissions
NotFound
Not Found (404) - Resource does not exist
Fields
Conflict
Conflict (409) - Resource already exists or state conflict
PreconditionFailed
Precondition Failed (412) - Conditional request failed
UnprocessableEntity
Unprocessable Entity (422) - Validation error
Fields
Locked
Locked (423) - Resource is locked
RateLimited
Rate Limited (429) - Too many requests
InternalServerError
Internal Server Error (500)
Service Unavailable (503)
ApiError
Generic API error with status code
ConfigError(String)
Configuration error
JsonError(Error)
JSON serialization/deserialization error
JsonPathError
JSON deserialization error with path information
IoError(String)
I/O error (file operations)
UrlParseError(ParseError)
URL parsing error
Implementations§
Source§impl FilesError
impl FilesError
Sourcepub fn not_found_resource(
message: impl Into<String>,
resource_type: impl Into<String>,
path: impl Into<String>,
) -> Self
pub fn not_found_resource( message: impl Into<String>, resource_type: impl Into<String>, path: impl Into<String>, ) -> Self
Create a NotFound error for a specific resource type
Sourcepub fn bad_request(message: impl Into<String>) -> Self
pub fn bad_request(message: impl Into<String>) -> Self
Create a BadRequest error with optional field context
Sourcepub fn bad_request_field(
message: impl Into<String>,
field: impl Into<String>,
) -> Self
pub fn bad_request_field( message: impl Into<String>, field: impl Into<String>, ) -> Self
Create a BadRequest error with field context
Sourcepub fn validation_failed(
message: impl Into<String>,
field: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn validation_failed( message: impl Into<String>, field: impl Into<String>, value: impl Into<String>, ) -> Self
Create an UnprocessableEntity error with validation context
Sourcepub fn rate_limited(
message: impl Into<String>,
retry_after: Option<u64>,
) -> Self
pub fn rate_limited( message: impl Into<String>, retry_after: Option<u64>, ) -> Self
Create a RateLimited error with retry-after context
Sourcepub fn with_resource_type(self, resource_type: impl Into<String>) -> Self
pub fn with_resource_type(self, resource_type: impl Into<String>) -> Self
Add resource context to a NotFound error
Sourcepub fn with_field(self, field: impl Into<String>) -> Self
pub fn with_field(self, field: impl Into<String>) -> Self
Add field context to a BadRequest error
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Extract the HTTP status code if this is an API error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable
Sourcepub fn retry_after(&self) -> Option<u64>
pub fn retry_after(&self) -> Option<u64>
Get retry-after duration if available
Trait Implementations§
Source§impl Debug for FilesError
impl Debug for FilesError
Source§impl Display for FilesError
impl Display for FilesError
Source§impl Error for FilesError
impl Error for FilesError
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
Source§impl From<Error> for FilesError
impl From<Error> for FilesError
Source§impl From<Error> for FilesError
impl From<Error> for FilesError
Source§impl From<ParseError> for FilesError
impl From<ParseError> for FilesError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for FilesError
impl !RefUnwindSafe for FilesError
impl Send for FilesError
impl Sync for FilesError
impl Unpin for FilesError
impl !UnwindSafe for FilesError
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.