diff --git a/libs/sdk-core/src/breez_services.rs b/libs/sdk-core/src/breez_services.rs index 323047634..8947c9e98 100644 --- a/libs/sdk-core/src/breez_services.rs +++ b/libs/sdk-core/src/breez_services.rs @@ -316,17 +316,20 @@ impl BreezServices { let payment = match self.send_payment(pay_req).await { Ok(p) => Ok(p), - Err(SdkError::SendPaymentFailed { err }) => { - let invoice = parse_invoice(cb.pr.as_str())?; - - return Ok(LnUrlPayResult::PayError { - data: LnUrlPayErrorData { - payment_hash: invoice.payment_hash, - reason: err, - }, - }); - } - Err(e) => Err(e), + Err(e) => match e { + SendPaymentError::InvalidInvoice { .. } => Err(e), + SendPaymentError::ServiceConnectivity { .. } => Err(e), + _ => { + let invoice = parse_invoice(cb.pr.as_str())?; + + return Ok(LnUrlPayResult::PayError { + data: LnUrlPayErrorData { + payment_hash: invoice.payment_hash, + reason: e.to_string(), + }, + }); + } + }, }? .payment; let details = match &payment.details { diff --git a/libs/sdk-core/src/error.rs b/libs/sdk-core/src/error.rs index 7d8ab2670..c9816c579 100644 --- a/libs/sdk-core/src/error.rs +++ b/libs/sdk-core/src/error.rs @@ -606,6 +606,14 @@ impl From for SendPaymentError { } } +impl From for LnUrlPayError { + fn from(err: InvoiceError) -> Self { + Self::InvalidInvoice { + err: err.to_string(), + } + } +} + impl From for SendPaymentError { fn from(value: NodeError) -> Self { match value {