go-nitro
go-nitro copied to clipboard
Nitro RPC Client needs error handling
I accidentally spun up an RPC server using nats. When I tried using the nitro-rpc-client (using the http/ws) instead of seeing some kind of error, all the CLI commands just return nothing:
$ npx ts-node src/cli.ts address
✨ Done in 1.42s.
❯ yarn start address
We need some basic error handling so we return a sensible error message from the client when something goes wrong.
Another (possibly better) example:
The rpc client may try to ask the nitro node to create a ledger channel with a counterparty when one already exists.
Currently, this causes a panic in the nitro node. This causes an uncaught exception in the rpc client, with no useful informatio printed out.
We need to
- not panic in the rpc server
- send an JSON RPC error response
- pick that up in the rpc client, print it out. not crash.