pub enum CoreError {
Show 50 variants
Database(String),
Validation(String),
NotFound(String),
InsufficientBalance {
required: Decimal,
available: Decimal,
},
TokenExists(String),
InvalidCurveParams,
CircuitBreakerTriggered,
SlippageExceeded {
expected: Decimal,
actual: Decimal,
},
OrderExpired,
TokenPaused,
ReputationTooLow {
required: Decimal,
current: Decimal,
},
MaxSupplyReached,
Unauthorized,
Serialization(String),
Calculation(String),
OrderNotFound(Uuid),
InvalidOrderQuantity(String),
InvalidPrice(String),
OrderAlreadyFilled,
OrderAlreadyCancelled,
InsufficientLiquidity(String),
PriceImpactTooHigh {
impact: Decimal,
max_impact: Decimal,
},
MarketClosed,
TradingHalted(Uuid),
PositionLimitExceeded {
current: Decimal,
maximum: Decimal,
},
DailyTradingLimitExceeded {
traded: Decimal,
limit: Decimal,
},
ExcessiveLeverage {
ratio: Decimal,
max_ratio: Decimal,
},
MarginCall {
equity: Decimal,
maintenance: Decimal,
},
PaymentNotFound(Uuid),
PaymentAlreadyConfirmed,
PaymentExpired,
InsufficientConfirmations {
required: u32,
current: u32,
},
KycRequired,
KycPending,
KycRejected(String),
CommitmentNotFound(Uuid),
CommitmentAlreadyVerified,
CommitmentDeadlinePassed,
RateLimitExceeded {
retry_after: u64,
},
TooManyRequests(Uuid),
ResourceLocked(String),
OptimisticLockFailed,
DeadlockDetected,
Configuration(String),
FeatureNotEnabled(String),
InvalidState(String),
AlreadyExists(String),
InvalidAmount,
InvalidBridgeRoute,
BridgeNotSupported,
}Expand description
Core error type for all kaccy-core operations
Variants§
Database(String)
A database operation failed
Validation(String)
Input validation failed
NotFound(String)
Requested resource was not found
InsufficientBalance
Account balance is insufficient for the operation
TokenExists(String)
A token with this identifier already exists
InvalidCurveParams
Bonding curve parameters are invalid
CircuitBreakerTriggered
A circuit breaker has been triggered for the token
SlippageExceeded
Trade slippage exceeded the configured tolerance
OrderExpired
Order has expired and can no longer be filled
TokenPaused
Token trading is currently paused
ReputationTooLow
User reputation is below the required threshold
MaxSupplyReached
Token maximum supply has been reached
Caller is not authorised to perform this action
Serialization(String)
Serialization or deserialization failed
Calculation(String)
A numeric calculation failed
OrderNotFound(Uuid)
The specified order was not found
InvalidOrderQuantity(String)
Order quantity is invalid
InvalidPrice(String)
Order price is invalid
OrderAlreadyFilled
Order has already been filled
OrderAlreadyCancelled
Order has already been cancelled
InsufficientLiquidity(String)
Insufficient market liquidity for the trade
PriceImpactTooHigh
Trade price impact exceeds the configured maximum
MarketClosed
Market is outside of its trading hours
TradingHalted(Uuid)
Trading for this token has been halted
PositionLimitExceeded
Position size exceeds the configured limit
DailyTradingLimitExceeded
Daily trading volume limit exceeded
ExcessiveLeverage
Leverage ratio is too high
MarginCall
Margin call: equity has fallen below maintenance margin
PaymentNotFound(Uuid)
The specified payment was not found
PaymentAlreadyConfirmed
Payment has already been confirmed and cannot be reprocessed
PaymentExpired
Payment has expired
InsufficientConfirmations
Not enough blockchain confirmations yet
KycRequired
KYC verification is required before this action
KycPending
KYC verification is in progress
KycRejected(String)
KYC verification was rejected
CommitmentNotFound(Uuid)
The specified commitment was not found
CommitmentAlreadyVerified
Commitment has already been verified
CommitmentDeadlinePassed
Commitment deadline has passed
RateLimitExceeded
Rate limit exceeded; retry after the given number of seconds
TooManyRequests(Uuid)
Too many requests from this user
ResourceLocked(String)
A resource is currently locked by another operation
OptimisticLockFailed
Optimistic locking failed because the resource was concurrently modified
DeadlockDetected
A database deadlock was detected
Configuration(String)
System configuration is invalid
FeatureNotEnabled(String)
A feature flag is not enabled
InvalidState(String)
Entity is in an invalid state for this operation
AlreadyExists(String)
Entity already exists
InvalidAmount
Provided amount is invalid
InvalidBridgeRoute
Specified bridge route is invalid
BridgeNotSupported
Bridge protocol is not supported
Implementations§
Source§impl CoreError
impl CoreError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if error is retryable (e.g., for retry logic)
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if error is a client error (4xx)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if error is a server error (5xx)
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Get HTTP status code for this error
Trait Implementations§
Source§impl Error for CoreError
impl Error for CoreError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for CoreError
impl RefUnwindSafe for CoreError
impl Send for CoreError
impl Sync for CoreError
impl Unpin for CoreError
impl UnsafeUnpin for CoreError
impl UnwindSafe for CoreError
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 more