diff --git a/Makefile b/Makefile index 293c287cfc4ffd8cb1ae05969f937e69eaadc25e..7bda2257aea480aaa7195aa83c55f8628e6f9f5d 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ test: check .PHONY: test_integration test_integration: - @go get -u github.com/monax/keys/cmd/monax-keys + @go get -u github.com/monax/bosmarmot/keys/cmd/monax-keys @go test ./keys/integration -tags integration @go test ./rpc/tm/integration -tags integration diff --git a/rpc/v0/websocket_service.go b/rpc/v0/websocket_service.go index 4c0072685a8e68bf26eacd0bc9ca371c28c44bdd..17b84e4409b54ed63d4db14c0a85217f7d02283a 100644 --- a/rpc/v0/websocket_service.go +++ b/rpc/v0/websocket_service.go @@ -21,6 +21,7 @@ import ( "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/logging/structure" logging_types "github.com/hyperledger/burrow/logging/types" "github.com/hyperledger/burrow/rpc" "github.com/hyperledger/burrow/rpc/v0/server" @@ -51,6 +52,15 @@ func NewWebsocketService(codec rpc.Codec, service rpc.Service, logger logging_ty // Process a request. func (ws *WebsocketService) Process(msg []byte, session *server.WSSession) { + defer func() { + if r := recover(); r != nil { + err := fmt.Errorf("panic in WebsocketService.Process(): %v", r) + logging.InfoMsg(ws.logger, "Panic in WebsocketService.Process()", structure.ErrorKey, err) + if !session.Closed() { + ws.writeError(err.Error(), "", rpc.INTERNAL_ERROR, session) + } + } + }() // Create new request object and unmarshal. req := &rpc.RPCRequest{} errU := json.Unmarshal(msg, req)