diff --git a/lib/ls-sdk-bindings/src/ls_sdk.udl b/lib/ls-sdk-bindings/src/ls_sdk.udl index 1cce7d4a8..d6eafa16b 100644 --- a/lib/ls-sdk-bindings/src/ls_sdk.udl +++ b/lib/ls-sdk-bindings/src/ls_sdk.udl @@ -6,15 +6,15 @@ enum LsSdkError { [Error] enum PaymentError { "AmountOutOfRange", + "AlreadyClaimed", + "Generic", "InvalidInvoice", - "SendError", - "PersistError", "InvalidPreimage", - "AlreadyClaimed", + "LwkError", "PairsNotFound", + "PersistError", + "SendError", "SignerError", - "BoltzError", - "LwkError", }; enum Network { diff --git a/lib/ls-sdk-core/src/model.rs b/lib/ls-sdk-core/src/model.rs index 4f821e1b7..cc9cf040e 100644 --- a/lib/ls-sdk-core/src/model.rs +++ b/lib/ls-sdk-core/src/model.rs @@ -98,32 +98,32 @@ pub enum PaymentError { #[error("Invoice amount is out of range")] AmountOutOfRange, - #[error("The specified invoice is not valid")] - InvalidInvoice, + #[error("The specified funds have already been claimed")] + AlreadyClaimed, - #[error("Could not sign/send the transaction: {err}")] - SendError { err: String }, + #[error("Generic error: {err}")] + Generic { err: String }, - #[error("Could not store the swap details locally")] - PersistError, + #[error("The specified invoice is not valid")] + InvalidInvoice, #[error("The generated preimage is not valid")] InvalidPreimage, - #[error("The specified funds have already been claimed")] - AlreadyClaimed, + #[error("Lwk error: {err}")] + LwkError { err: String }, #[error("Boltz did not return any pairs from the request")] PairsNotFound, - #[error("Could not sign the transaction: {err}")] - SignerError { err: String }, + #[error("Could not store the swap details locally")] + PersistError, - #[error("Boltz error: {err}")] - BoltzError { err: String }, + #[error("Could not sign/send the transaction: {err}")] + SendError { err: String }, - #[error("Lwk error: {err}")] - LwkError { err: String }, + #[error("Could not sign the transaction: {err}")] + SignerError { err: String }, } impl From for PaymentError { @@ -134,9 +134,9 @@ impl From for PaymentError { return PaymentError::AlreadyClaimed; } - PaymentError::BoltzError { err: msg } + PaymentError::Generic { err: msg } } - _ => PaymentError::BoltzError { + _ => PaymentError::Generic { err: format!("{err:?}"), }, } diff --git a/lib/ls-sdk-core/src/wallet.rs b/lib/ls-sdk-core/src/wallet.rs index f7cf91cd1..40890277e 100644 --- a/lib/ls-sdk-core/src/wallet.rs +++ b/lib/ls-sdk-core/src/wallet.rs @@ -447,7 +447,7 @@ impl Wallet { // TODO The request should not allow setting both invoice and onchain amounts, so this case shouldn't be possible. // See example of how it's done in the SDK. - _ => Err(PaymentError::BoltzError { + _ => Err(PaymentError::Generic { err: "Both invoice and onchain amounts were specified".into(), }), }?;