Skip to content

Commit

Permalink
fix(core): handle unknown error for unsupported payment feature (#4640)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi authored Oct 29, 2024
1 parent 61e0084 commit 2eb8c22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/api/src/services/lnd/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const KnownLndErrorDetails = {
MissingDependentFeature: /missing dependent feature/,
FeaturePairExists: /feature pair exists/,
InvoiceAmountTooLarge: /invoice amount .* BTC is too large/,
UnsupportedPaymentFeature: /UnsupportedPaymentFeatureInPayRequest/,

// On-chain
InsufficientFunds: /insufficient funds available to construct transaction/,
Expand Down
2 changes: 2 additions & 0 deletions core/api/src/services/lnd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,7 @@ const handleSendPaymentLndErrors = ({
case match(KnownLndErrorDetails.InsufficientBalanceToAttemptPayment):
return new InsufficientBalanceForLnPaymentError()
case match(KnownLndErrorDetails.FeaturePairExists):
case match(KnownLndErrorDetails.UnsupportedPaymentFeature):
return new InvalidFeatureBitsForLndInvoiceError()
case match(KnownLndErrorDetails.InsufficientFee):
return new InsufficientFeeForLnPaymentError()
Expand Down Expand Up @@ -1264,6 +1265,7 @@ const handleCommonRouteNotFoundErrors = (err: Error | unknown) => {
return new DestinationMissingDependentFeatureError()

case match(KnownLndErrorDetails.FeaturePairExists):
case match(KnownLndErrorDetails.UnsupportedPaymentFeature):
return new InvalidFeatureBitsForLndInvoiceError()

default:
Expand Down

0 comments on commit 2eb8c22

Please sign in to comment.