pub enum DydxError {
Show 16 variants
Http(DydxHttpError),
WebSocket(DydxWsError),
Grpc(Box<Status>),
Signing(String),
Encoding(EncodeError),
Decoding(DecodeError),
Json {
message: String,
raw: Option<String>,
},
Config(String),
InvalidData(String),
InvalidOrderSide(String),
UnsupportedOrderType(String),
NotImplemented(String),
Order(String),
Parse(String),
Wallet(String),
Nautilus(Error),
}Expand description
The main error type for all dYdX adapter operations.
Variants§
Http(DydxHttpError)
HTTP client errors.
WebSocket(DydxWsError)
WebSocket connection errors.
Grpc(Box<Status>)
gRPC errors from Cosmos SDK node.
Signing(String)
Transaction signing errors.
Encoding(EncodeError)
Protocol buffer encoding errors.
Decoding(DecodeError)
Protocol buffer decoding errors.
Json
JSON serialization/deserialization errors.
Config(String)
Configuration errors.
InvalidData(String)
Invalid data errors.
InvalidOrderSide(String)
Invalid order side error.
UnsupportedOrderType(String)
Unsupported order type error.
NotImplemented(String)
Feature not yet implemented.
Order(String)
Order construction and submission errors.
Parse(String)
Parsing errors (e.g., string to number conversions).
Wallet(String)
Wallet and account derivation errors.
Nautilus(Error)
Nautilus core errors.
Implementations§
Source§impl DydxError
impl DydxError
Sourcepub fn is_sequence_mismatch(&self) -> bool
pub fn is_sequence_mismatch(&self) -> bool
Returns true if this error is a sequence mismatch (code=32 or code=104 with sequence hint).
Sequence mismatch occurs when:
- Multiple transactions race for the same sequence number
- A transaction was submitted but not yet included in a block
- The local sequence counter is out of sync with chain state
On dYdX v4, sequence mismatches can manifest as either:
- code=32: Standard Cosmos SDK “account sequence mismatch”
- code=104: dYdX authenticator “signature verification failed; please verify sequence”
These errors are typically recoverable by resyncing the sequence from chain and rebuilding the transaction.
Sourcepub fn is_tx_in_mempool(&self) -> bool
pub fn is_tx_in_mempool(&self) -> bool
Returns true if this error indicates the transaction is already in the mempool (code=19).
This is benign for short-term orders – the transaction was already accepted by the mempool on a previous submission and will be processed. Callers can safely treat this as success.
Sourcepub fn is_cancel_already_in_memclob(&self) -> bool
pub fn is_cancel_already_in_memclob(&self) -> bool
Returns true if this error indicates a duplicate cancel already in the memclob (code=9).
dYdX rejects cancel messages when an existing cancel for the same order has a
greater-than-or-equal GoodTilBlock. The original cancel will be processed.
Sourcepub fn is_order_does_not_exist(&self) -> bool
pub fn is_order_does_not_exist(&self) -> bool
Returns true if this error indicates the order to cancel does not exist (code=3006).
The order was already filled, expired, or previously cancelled.
Sourcepub fn is_benign_cancel_error(&self) -> bool
pub fn is_benign_cancel_error(&self) -> bool
Returns true if this error is benign for short-term cancel operations.
Benign cancel errors occur during overlapping cancel waves (common in grid MM):
- code=19: Transaction already in mempool cache (duplicate tx bytes)
- code=9: Cancel already exists in memclob with >= GoodTilBlock
- code=3006: Order to cancel does not exist (already filled/expired/cancelled)
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if this error is likely transient and worth retrying.
Transient errors include:
- Sequence mismatch (recoverable by resync)
- Network timeouts
- Temporary node unavailability
Trait Implementations§
Source§impl Error for DydxError
impl Error for DydxError
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()
Source§impl From<DecodeError> for DydxError
impl From<DecodeError> for DydxError
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Source§impl From<DydxHttpError> for DydxError
impl From<DydxHttpError> for DydxError
Source§fn from(source: DydxHttpError) -> Self
fn from(source: DydxHttpError) -> Self
Source§impl From<DydxWsError> for DydxError
impl From<DydxWsError> for DydxError
Source§fn from(source: DydxWsError) -> Self
fn from(source: DydxWsError) -> Self
Source§impl From<EncodeError> for DydxError
impl From<EncodeError> for DydxError
Source§fn from(source: EncodeError) -> Self
fn from(source: EncodeError) -> Self
Auto Trait Implementations§
impl Freeze for DydxError
impl !RefUnwindSafe for DydxError
impl Send for DydxError
impl Sync for DydxError
impl Unpin for DydxError
impl UnsafeUnpin for DydxError
impl !UnwindSafe for DydxError
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.