Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parsing lnd errors for error message #3402

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions core/api/src/services/lnd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getPendingChannels,
getPendingPayments,
getWalletInfo,
LightningError as LnError,
payViaPaymentDetails,
payViaRoutes,
settleHodlInvoice,
Expand Down Expand Up @@ -78,11 +79,7 @@ import {
import { IncomingOnChainTransaction } from "@/domain/bitcoin/onchain"
import { CacheKeys } from "@/domain/cache"
import { LnFees } from "@/domain/payments"
import {
WalletCurrency,
parseErrorMessageFromUnknown,
paymentAmountFromNumber,
} from "@/domain/shared"
import { WalletCurrency, paymentAmountFromNumber } from "@/domain/shared"

import { LocalCacheService } from "@/services/cache"
import { wrapAsyncFunctionsToRunInSpan } from "@/services/tracing"
Expand Down Expand Up @@ -1146,11 +1143,7 @@ const handleCommonLightningServiceErrors = (err: Error | unknown) => {
case match(KnownLndErrorDetails.ConnectionRefused):
return new OffChainServiceBusyError()
default:
return new UnknownLightningServiceError(
msgForUnknown({
message: parseErrorMessageFromUnknown(err),
} as Error),
)
return new UnknownLightningServiceError(msgForUnknown(err as LnError))
}
}

Expand All @@ -1166,15 +1159,11 @@ const handleCommonRouteNotFoundErrors = (err: Error | unknown) => {
return new DestinationMissingDependentFeatureError()

default:
return new UnknownRouteNotFoundError(
msgForUnknown({
message: parseErrorMessageFromUnknown(err),
} as Error),
)
return new UnknownRouteNotFoundError(msgForUnknown(err as LnError))
}
}

const msgForUnknown = (err: Error) =>
const msgForUnknown = (err: LnError) =>
JSON.stringify({
parsedLndErrorDetails: parseLndErrorDetails(err),
detailsFromLnd: err,
Expand Down
Loading