From cf5ac8272db8bb6bb5746e2612c6f8f90074d4df Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 27 Jul 2025 21:12:49 +0200 Subject: [PATCH] Handle error property in NWC response (#2343) --- wallets/lib/protocols/nwc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wallets/lib/protocols/nwc.js b/wallets/lib/protocols/nwc.js index 12a2a72f..9e4a3561 100644 --- a/wallets/lib/protocols/nwc.js +++ b/wallets/lib/protocols/nwc.js @@ -45,7 +45,9 @@ export async function nwcTryRun (fun, { url }, { signal }) { const nostr = new Nostr() try { const nwc = await getNwc(nostr, url, { signal }) - return await fun(nwc) + const res = await fun(nwc) + if (res.error) throw new Error(res.error) + return res } catch (e) { if (e.error) throw new Error(e.error.message || e.error.code) throw e