diff options
| author | Adam Soltys <[email protected]> | 2026-05-17 23:51:52 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-05-17 23:51:52 -0700 |
| commit | 4dd5c51fa238fefb1c06cc1da1b1b77344139213 (patch) | |
| tree | c37d42d2de01bd44bcf7ad1b8f306a2d847bc0a0 | |
| parent | c0f087a9102ef325eab146832055da7ec2ee3220 (diff) | |
| download | coinos-server-4dd5c51fa238fefb1c06cc1da1b1b77344139213.tar.gz coinos-server-4dd5c51fa238fefb1c06cc1da1b1b77344139213.zip | |
getAddressType: surface lq downtime as actionable error
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) <[email protected]>
| -rw-r--r-- | lib/payments.ts | 12 |
1 files changed, 11 insertions, 1 deletions
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"); } } |
