diff options
| author | Adam Soltys <[email protected]> | 2025-02-11 21:41:06 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-02-12 12:35:58 +0000 |
| commit | c8cdd168b5504b2572a193d64b57f67a5f97a35c (patch) | |
| tree | 5c7fa0d12eb59d1ad1b3210434713ed2e45e44c4 /lib | |
| parent | 22b09ab76e5d82c97e38597a7244edb76dff9989 (diff) | |
| download | coinos-server-c8cdd168b5504b2572a193d64b57f67a5f97a35c.tar.gz coinos-server-c8cdd168b5504b2572a193d64b57f67a5f97a35c.zip | |
nwc error logging
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nwc.ts | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -5,7 +5,7 @@ import ln from "$lib/ln"; import { err, l } from "$lib/logging"; import { handleZap, serverPubkey } from "$lib/nostr"; import { sendInternal, sendKeysend, sendLightning } from "$lib/payments"; -import { getInvoice, sleep } from "$lib/utils"; +import { fail, getInvoice, sleep } from "$lib/utils"; import { Relay } from "nostr"; import { finalizeEvent, nip04, nip19 } from "nostr-tools"; import type { UnsignedEvent } from "nostr-tools"; @@ -58,10 +58,11 @@ export default () => { if (!methods.includes(method)) return; - const app = await g(pubkey); - const user = await g(`user:${app.uid}`); - try { + const app = await g(pubkey); + if (!app) fail(`pubkey not found`); + const user = await g(`user:${app.uid}`); + const result = await handle(method, params, ev, app, user); const payload = JSON.stringify({ result_type: method, ...result }); content = await nip04.encrypt(sk, pubkey, payload); @@ -83,13 +84,12 @@ export default () => { err( "problem with nwc", pubkey, - app?.name, + method, JSON.stringify(params), e.message, ); } } catch (e) { - console.log(e); err("problem with nwc", e.message); } }); |
