Skip to content

Commit f85f1f2

Browse files
committed
f Change back error types
1 parent fabadc7 commit f85f1f2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ pub enum Error {
1414
/// Payment of the given invoice has already been intiated.
1515
NonUniquePaymentHash,
1616
/// The given invoice is invalid.
17-
InvoiceInvalid,
17+
InvalidInvoice,
1818
/// Invoice creation failed.
1919
InvoiceCreationFailed,
2020
/// There are insufficient funds to complete the given operation.
21-
FundsInsufficient,
21+
InsufficientFunds,
2222
/// An attempted payment has failed.
2323
PaymentFailed,
2424
/// A given peer info could not be parsed.
@@ -47,9 +47,9 @@ impl fmt::Display for Error {
4747
}
4848
Self::ConnectionFailed => write!(f, "Network connection closed."),
4949
Self::NonUniquePaymentHash => write!(f, "An invoice must not get payed twice."),
50-
Self::InvoiceInvalid => write!(f, "The given invoice is invalid."),
50+
Self::InvalidInvoice => write!(f, "The given invoice is invalid."),
5151
Self::InvoiceCreationFailed => write!(f, "Failed to create invoice."),
52-
Self::FundsInsufficient => {
52+
Self::InsufficientFunds => {
5353
write!(f, "There are insufficient funds to complete the given operation.")
5454
}
5555
Self::PaymentFailed => write!(f, "Failed to send the given payment."),

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl Node {
720720
let cur_balance = self.wallet.get_balance()?;
721721
if cur_balance.get_spendable() < channel_amount_sats {
722722
log_error!(self.logger, "Unable to create channel due to insufficient funds.");
723-
return Err(Error::FundsInsufficient);
723+
return Err(Error::InsufficientFunds);
724724
}
725725

726726
let peer_info = PeerInfo::try_from(node_pubkey_and_address.to_string())?;
@@ -868,7 +868,7 @@ impl Node {
868868
}
869869
Err(payment::PaymentError::Invoice(e)) => {
870870
log_error!(self.logger, "Failed to send payment due to invalid invoice: {}", e);
871-
Err(Error::InvoiceInvalid)
871+
Err(Error::InvalidInvoice)
872872
}
873873
Err(payment::PaymentError::Sending(e)) => {
874874
log_error!(self.logger, "Failed to send payment: {:?}", e);

src/tests/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ fn channel_open_fails_when_funds_insufficient() {
226226
let node_b_addr =
227227
format!("{}@{}", node_b.node_id().unwrap(), node_b.listening_address().unwrap());
228228
assert_eq!(
229-
Err(Error::FundsInsufficient),
229+
Err(Error::InsufficientFunds),
230230
node_a.connect_open_channel(&node_b_addr, 120000, true)
231231
);
232232
}

0 commit comments

Comments
 (0)