From 4dd5c51fa238fefb1c06cc1da1b1b77344139213 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 17 May 2026 23:51:52 -0700 Subject: getAddressType: surface lq downtime as actionable error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When lq.getAddressInfo throws on a connection error (ECONNREFUSED / ETIMEDOUT / "Unable to connect"), the generic catch was reporting "unrecognized address" — misleading for both users (who think their address is wrong) and operators (who can't tell user error from infrastructure problems in the logs). Map connection errors to a specific "liquid temporarily unavailable" message instead. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/payments.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/payments.ts b/lib/payments.ts index 5984a813..cf6a344f 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -1111,7 +1111,17 @@ const getAddressType = async (a) => { try { await lq.getAddressInfo(a); return PaymentType.liquid; - } catch (e) { + } catch (e: any) { + // Distinguish "lq is down" from "address isn't liquid" so users get a + // useful message instead of "unrecognized address" when cs/lq is the + // actual problem. + if ( + e?.message?.includes("Unable to connect") || + e?.code === "ECONNREFUSED" || + e?.code === "ETIMEDOUT" + ) { + fail("liquid temporarily unavailable"); + } fail("unrecognized address"); } } -- cgit v1.2.3