mcp: don't panic on bad JSON RPC input (#177)
Log internal errors from the jsonprc2 package, instead of panicking. Fixes #175.
This commit is contained in:
parent
6e5ba9585f
commit
261a63ccc0
1 changed files with 2 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"sync"
|
||||
|
|
@ -120,6 +121,7 @@ func connect[H handler](ctx context.Context, t Transport, b binder[H]) (H, error
|
|||
OnDone: func() {
|
||||
b.disconnect(h)
|
||||
},
|
||||
OnInternalError: func(err error) { log.Printf("jsonrpc2 error: %v", err) },
|
||||
})
|
||||
assert(preempter.conn != nil, "unbound preempter")
|
||||
h.setConn(conn)
|
||||
|
|
|
|||
Loading…
Reference in a new issue