pub enum RhoodError {
Show 14 variants
NotAuthenticated,
ChallengeRequired(ChallengeType),
TokenExpired,
Api {
status: u16,
message: String,
},
RateLimited {
retry_after_secs: u64,
},
InvalidSymbol(String),
InvalidParameter(String),
ReadOnlyMode,
InvalidOrder(String),
DeviceVerificationRequired,
Http(Error),
Json(Error),
Io(Error),
Timeout(String),
}Expand description
Errors that can occur when interacting with the Robinhood API.
§Example
use rhood_core::{RobinhoodClient, RhoodError};
let client = RobinhoodClient::new()?;
match client.login(username, password, None).await {
Ok(()) => println!("authenticated"),
Err(RhoodError::ChallengeRequired(challenge_type)) => {
println!("verification needed via {challenge_type}");
}
Err(RhoodError::DeviceVerificationRequired) => {
println!("run `rhood login` interactively first");
}
Err(other) => return Err(other),
}Variants§
NotAuthenticated
The client is not authenticated and cannot make API calls.
ChallengeRequired(ChallengeType)
The server issued an authentication challenge that must be answered.
TokenExpired
The access token has expired and automatic refresh failed.
Api
The Robinhood API returned a non-success HTTP status.
Fields
RateLimited
The API returned HTTP 429, indicating the client should back off.
InvalidSymbol(String)
The requested ticker symbol was not found.
InvalidParameter(String)
A parameter provided to an API method was invalid.
ReadOnlyMode
A write operation was attempted while the client is in read-only mode.
InvalidOrder(String)
An order request contains invalid or contradictory parameters.
DeviceVerificationRequired
Device verification is required before the client can authenticate.
Http(Error)
An HTTP transport error from the underlying HTTP client.
Json(Error)
A JSON serialization or deserialization error.
Io(Error)
A filesystem I/O error.
Timeout(String)
An operation timed out waiting for a response or approval.
Trait Implementations§
Source§impl Debug for RhoodError
impl Debug for RhoodError
Source§impl Display for RhoodError
impl Display for RhoodError
Source§impl Error for RhoodError
impl Error for RhoodError
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()