go-nitro icon indicating copy to clipboard operation
go-nitro copied to clipboard

Nitro RPC Client needs error handling

Open lalexgap opened this issue 2 years ago • 1 comments

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.

lalexgap avatar May 04 '23 19:05 lalexgap

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.

geoknee avatar May 19 '23 16:05 geoknee