#[repr(u32)]pub enum ApiErrorCode {
MalformedRequest = 40_010_000,
InvalidCredentials = 40_110_000,
Forbidden = 40_310_000,
NotFound = 40_410_000,
UnprocessableEntity = 42_210_000,
RateLimitExceeded = 42_910_000,
InternalServerError = 50_010_000,
Unknown = 0,
}Expand description
Alpaca-specific API error codes.
These codes are returned by the Alpaca API to indicate specific error conditions.
Variants§
MalformedRequest = 40_010_000
Malformed request body or parameters.
InvalidCredentials = 40_110_000
Invalid or missing authentication credentials.
Forbidden = 40_310_000
Access forbidden for this resource.
NotFound = 40_410_000
Requested resource not found.
UnprocessableEntity = 42_210_000
Request validation failed.
RateLimitExceeded = 42_910_000
Rate limit exceeded.
InternalServerError = 50_010_000
Internal server error.
Unknown = 0
Unknown error code.
Implementations§
Source§impl ApiErrorCode
impl ApiErrorCode
Sourcepub fn from_code(code: u32) -> ApiErrorCode
pub fn from_code(code: u32) -> ApiErrorCode
Creates an ApiErrorCode from a numeric code.
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Returns true if this is a client error (4xx).
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Returns true if this is a server error (5xx).
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is retryable.
Trait Implementations§
Source§impl Clone for ApiErrorCode
impl Clone for ApiErrorCode
Source§fn clone(&self) -> ApiErrorCode
fn clone(&self) -> ApiErrorCode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiErrorCode
impl Debug for ApiErrorCode
Source§impl<'de> Deserialize<'de> for ApiErrorCode
impl<'de> Deserialize<'de> for ApiErrorCode
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApiErrorCode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApiErrorCode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ApiErrorCode
impl Display for ApiErrorCode
Source§impl Error for ApiErrorCode
impl Error for ApiErrorCode
1.30.0 · 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()
Source§impl PartialEq for ApiErrorCode
impl PartialEq for ApiErrorCode
Source§impl Serialize for ApiErrorCode
impl Serialize for ApiErrorCode
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for ApiErrorCode
impl Eq for ApiErrorCode
impl StructuralPartialEq for ApiErrorCode
Auto Trait Implementations§
impl Freeze for ApiErrorCode
impl RefUnwindSafe for ApiErrorCode
impl Send for ApiErrorCode
impl Sync for ApiErrorCode
impl Unpin for ApiErrorCode
impl UnwindSafe for ApiErrorCode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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.