pub enum FinanceError {
Show 14 variants
AuthenticationFailed {
context: String,
},
SymbolNotFound {
symbol: Option<String>,
context: String,
},
RateLimited {
retry_after: Option<u64>,
},
HttpError(Error),
JsonParseError(Error),
ResponseStructureError {
field: String,
context: String,
},
InvalidParameter {
param: String,
reason: String,
},
Timeout {
timeout_ms: u64,
},
ServerError {
status: u16,
context: String,
},
UnexpectedResponse(String),
InternalError(String),
ApiError(String),
RuntimeError(Error),
IndicatorError(IndicatorError),
}Expand description
Main error type for the library
Variants§
AuthenticationFailed
Authentication failed (Yahoo Finance, SEC EDGAR, etc.)
SymbolNotFound
The requested symbol was not found
RateLimited
Rate limit exceeded
HttpError(Error)
HTTP request error
JsonParseError(Error)
Failed to parse JSON response
ResponseStructureError
Response structure error - missing or malformed fields
InvalidParameter
Invalid parameter provided
Timeout
Network timeout
ServerError
Server error (5xx status codes)
UnexpectedResponse(String)
Unexpected API response
InternalError(String)
Internal error
ApiError(String)
General API error
RuntimeError(Error)
Tokio runtime error
IndicatorError(IndicatorError)
Indicator calculation error
Implementations§
Source§impl FinanceError
impl FinanceError
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Check if this error is retriable
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Check if this error indicates an authentication issue
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this error indicates a not found issue
Sourcepub fn retry_after_secs(&self) -> Option<u64>
pub fn retry_after_secs(&self) -> Option<u64>
Get retry delay in seconds (for exponential backoff)
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
Categorize errors for logging/metrics
Sourcepub fn with_symbol(self, symbol: impl Into<String>) -> Self
pub fn with_symbol(self, symbol: impl Into<String>) -> Self
Add symbol context to error (fluent API)
Sourcepub fn with_context(self, context: impl Into<String>) -> Self
pub fn with_context(self, context: impl Into<String>) -> Self
Add context to error (fluent API)
Source§impl FinanceError
impl FinanceError
Sourcepub fn parse_error(msg: impl Into<String>) -> Self
👎Deprecated since 2.0.0: Use ResponseStructureError instead
pub fn parse_error(msg: impl Into<String>) -> Self
Create a ParseError from a string (for backward compatibility)
Trait Implementations§
Source§impl Debug for FinanceError
impl Debug for FinanceError
Source§impl Display for FinanceError
impl Display for FinanceError
Source§impl Error for FinanceError
impl Error for FinanceError
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 FinanceError
impl From<Error> for FinanceError
Source§impl From<Error> for FinanceError
impl From<Error> for FinanceError
Source§impl From<Error> for FinanceError
impl From<Error> for FinanceError
Source§impl From<IndicatorError> for FinanceError
impl From<IndicatorError> for FinanceError
Source§fn from(source: IndicatorError) -> Self
fn from(source: IndicatorError) -> Self
Source§impl From<StreamError> for FinanceError
impl From<StreamError> for FinanceError
Source§fn from(e: StreamError) -> Self
fn from(e: StreamError) -> Self
Auto Trait Implementations§
impl Freeze for FinanceError
impl !RefUnwindSafe for FinanceError
impl Send for FinanceError
impl Sync for FinanceError
impl Unpin for FinanceError
impl UnsafeUnpin for FinanceError
impl !UnwindSafe for FinanceError
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> 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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§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.