#[non_exhaustive]pub enum Error {
MissingApiKey,
InvalidBaseUrl(String),
MissingArgument(&'static str),
Api {
status: u16,
message: String,
},
RateLimited {
status: u16,
message: String,
},
EmptyResult {
symbol: String,
search_query: String,
endpoint: &'static str,
},
EndpointUnavailable {
endpoint: &'static str,
message: &'static str,
},
Http(Error),
Json(Error),
}Expand description
Errors returned by the FMP CLI and client.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MissingApiKey
The API key was not provided.
InvalidBaseUrl(String)
The configured base URL is invalid.
MissingArgument(&'static str)
A required CLI argument was not provided.
Api
The API returned a non-successful response.
Fields
RateLimited
The API rate-limited the request.
Fields
EmptyResult
A strict symbol lookup returned no data.
Fields
A CLI command maps to an endpoint that FMP no longer documents for the stable API.
Http(Error)
The HTTP client failed before receiving a usable response.
Json(Error)
JSON serialization failed while rendering output.
Implementations§
Source§impl Error
impl Error
Sourcepub fn exit_code(&self) -> ExitCode
pub fn exit_code(&self) -> ExitCode
Returns a process exit code for this error.
Codes follow a simple convention:
2- usage/argument error (missing required CLI argument)3- configuration error (missing API key, invalid base URL)4- network/HTTP error5- API error (server returned an error response, including rate limits)6- parse error (JSON deserialization failed)7- empty symbol result in strict mode
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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