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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -120,6 +121,7 @@ func connect[H handler](ctx context.Context, t Transport, b binder[H]) (H, error
|
||||||
OnDone: func() {
|
OnDone: func() {
|
||||||
b.disconnect(h)
|
b.disconnect(h)
|
||||||
},
|
},
|
||||||
|
OnInternalError: func(err error) { log.Printf("jsonrpc2 error: %v", err) },
|
||||||
})
|
})
|
||||||
assert(preempter.conn != nil, "unbound preempter")
|
assert(preempter.conn != nil, "unbound preempter")
|
||||||
h.setConn(conn)
|
h.setConn(conn)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue