Skip to content

Commit

Permalink
Rename BoltzError to Generic (#96)
Browse files Browse the repository at this point in the history
* Rename BoltzError to Generic

* Alphabetically order error enum variants
  • Loading branch information
ok300 authored Apr 19, 2024
1 parent 908c9be commit f138f6a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions lib/ls-sdk-bindings/src/ls_sdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
32 changes: 16 additions & 16 deletions lib/ls-sdk-core/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<boltz_client::error::Error> for PaymentError {
Expand All @@ -134,9 +134,9 @@ impl From<boltz_client::error::Error> for PaymentError {
return PaymentError::AlreadyClaimed;
}

PaymentError::BoltzError { err: msg }
PaymentError::Generic { err: msg }
}
_ => PaymentError::BoltzError {
_ => PaymentError::Generic {
err: format!("{err:?}"),
},
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ls-sdk-core/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
}?;
Expand Down

0 comments on commit f138f6a

Please sign in to comment.