mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-17 17:44:02 -05:00
Return proper error to CLI for all expected scenarios
When a CLI requests a spot price have some errors that are expected, where we can provide a proper error message for the CLI: - Balance of ASB too low - Buy amount sent by CLI exceeds maximum buy amount accepted by ASB - ASB is running in maintenance mode and does not accept incoming swap requests All of these errors returns a proper error to the CLI and prints a warning in the ASB logs. Any other unexpected error will result in closing the channel with the CLI and printing an error in the ASB logs.
This commit is contained in:
parent
f6497778ed
commit
ea76ae5821
5 changed files with 55 additions and 53 deletions
|
|
@ -192,12 +192,6 @@ pub struct InsufficientFunds {
|
|||
pub actual: Amount,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, thiserror::Error)]
|
||||
#[error("The balance is too low, current balance: {balance}")]
|
||||
pub struct BalanceTooLow {
|
||||
pub balance: Amount,
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug, Clone, PartialEq)]
|
||||
#[error("Overflow, cannot convert {0} to u64")]
|
||||
pub struct OverflowError(pub String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue