#[non_exhaustive]pub enum PerpCityError {
Show 17 variants
InvalidPrice {
reason: String,
},
InvalidMargin {
reason: String,
},
InvalidLeverage {
reason: String,
},
InvalidTickRange {
lower: i32,
upper: i32,
},
InvalidMarginRatio {
value: u32,
min: u32,
max: u32,
},
InvalidConfig {
reason: String,
},
Overflow {
context: String,
},
TxReverted {
reason: String,
},
EventNotFound {
event_name: String,
},
GasPriceUnavailable {
reason: String,
},
TooManyInFlight {
count: usize,
max: usize,
},
PerpNotFound {
perp_id: U256,
},
PositionNotFound {
pos_id: U256,
},
ModuleNotRegistered {
module: String,
},
AlloyContract(Error),
AlloyTransport(TransportError),
Serde(Error),
}Expand description
Central error type for the PerpCity SDK.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidPrice
Price must be positive and within protocol bounds.
InvalidMargin
Margin does not meet the minimum opening requirement.
InvalidLeverage
Leverage is outside the allowed range for this perp.
InvalidTickRange
Tick range violates protocol bounds or spacing.
InvalidMarginRatio
Margin ratio is outside the allowed [min, max] window.
InvalidConfig
A configuration value is invalid or missing.
Overflow
An arithmetic operation overflowed.
TxReverted
A sent transaction reverted on-chain.
EventNotFound
An expected event was not found in the transaction receipt.
Could not estimate or fetch gas price from the network.
TooManyInFlight
Too many unconfirmed transactions in flight.
PerpNotFound
The perp does not exist on-chain.
PositionNotFound
The position does not exist on-chain.
ModuleNotRegistered
A required module is not registered.
AlloyContract(Error)
Alloy contract call or ABI error.
AlloyTransport(TransportError)
Alloy transport (RPC) error.
Serde(Error)
JSON serialization / deserialization error.
Trait Implementations§
Source§impl Debug for PerpCityError
impl Debug for PerpCityError
Source§impl Display for PerpCityError
impl Display for PerpCityError
Source§impl Error for PerpCityError
impl Error for PerpCityError
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 PerpCityError
impl From<Error> for PerpCityError
Source§impl From<Error> for PerpCityError
impl From<Error> for PerpCityError
Source§impl From<RpcError<TransportErrorKind>> for PerpCityError
impl From<RpcError<TransportErrorKind>> for PerpCityError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Auto Trait Implementations§
impl Freeze for PerpCityError
impl !RefUnwindSafe for PerpCityError
impl Send for PerpCityError
impl Sync for PerpCityError
impl Unpin for PerpCityError
impl UnsafeUnpin for PerpCityError
impl !UnwindSafe for PerpCityError
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> 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.