Fix error message if no route found (#2534)

This commit is contained in:
ekzyis 2025-09-15 22:06:25 +02:00 committed by GitHub
parent d9d0ba2903
commit c4042fdf4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,17 +60,11 @@ export async function estimateRouteFee ({ lnd, destination, tokens, mtokens, req
timeout timeout
}, (err, res) => { }, (err, res) => {
if (err) { if (err) {
if (res?.failure_reason) { return reject(err)
reject(new Error(`Unable to estimate route: ${res.failure_reason}`))
} else {
reject(err)
}
return
} }
if (res.routing_fee_msat < 0 || res.time_lock_delay <= 0) { if (res.failure_reason !== 'FAILURE_REASON_NONE' || res.routing_fee_msat < 0 || res.time_lock_delay <= 0) {
reject(new Error('Unable to estimate route, excessive values: ' + JSON.stringify(res))) return reject(new Error(`Unable to estimate route: ${res.failure_reason}`))
return
} }
resolve({ resolve({