pub enum WattpadError {
RequestError(Error),
ParseError(Error),
AuthenticationFailed,
AuthenticationRequired {
field: String,
context: String,
},
MissingRequiredField {
field: String,
context: String,
},
UserNotFound,
StoryNotFound,
PermissionDeniedNotLoggedIn,
AccessDenied,
ApiError {
code: i64,
error_type: String,
message: String,
},
}
Expand description
The primary error type for all operations in the wattpad
crate.
Variants§
RequestError(Error)
An error occurred during a network request (e.g., connection timeout, DNS failure).
ParseError(Error)
An error occurred while parsing the JSON response from the API.
AuthenticationFailed
An authentication attempt failed, likely due to invalid credentials.
AuthenticationRequired
A requested field or endpoint requires authentication, but the client is not logged in.
Fields
MissingRequiredField
A required field was missing from the API response.
Fields
UserNotFound
A specific API error (code 1014) indicating the requested user was not found.
StoryNotFound
A specific API error (code 1017) indicating the requested story was not found.
PermissionDeniedNotLoggedIn
A specific API error (code 1018) indicating permission was denied because the user is not logged in.
AccessDenied
A specific API error (code 1154) indicating access to a resource was denied.
ApiError
A catch-all for any other error returned by the Wattpad API.
Trait Implementations§
Source§impl Debug for WattpadError
impl Debug for WattpadError
Source§impl Display for WattpadError
impl Display for WattpadError
Source§impl Error for WattpadError
impl Error for WattpadError
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 WattpadError
impl From<Error> for WattpadError
Auto Trait Implementations§
impl Freeze for WattpadError
impl !RefUnwindSafe for WattpadError
impl Send for WattpadError
impl Sync for WattpadError
impl Unpin for WattpadError
impl !UnwindSafe for WattpadError
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.