From 3fd36116f9cece75534af3fe43660f93752262d9 Mon Sep 17 00:00:00 2001 From: postmannen Date: Mon, 4 Apr 2022 05:34:18 +0200 Subject: [PATCH] add original msg to json errors on socket --- message_readers.go | 2 +- steward_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/message_readers.go b/message_readers.go index b11cb9b..9889a17 100644 --- a/message_readers.go +++ b/message_readers.go @@ -193,7 +193,7 @@ func (s *server) readSocket() { // unmarshal the JSON into a struct sams, err := s.convertBytesToSAMs(readBytes) if err != nil { - er := fmt.Errorf("error: malformed json received on socket: %v", err) + er := fmt.Errorf("error: malformed json received on socket: %s\n %v", readBytes, err) s.errorKernel.errSend(s.processInitial, Message{}, er) return } diff --git a/steward_test.go b/steward_test.go index 2a34760..dda3a3d 100644 --- a/steward_test.go +++ b/steward_test.go @@ -57,6 +57,7 @@ func TestStewardServer(t *testing.T) { DefaultMessageTimeout: 3, EnableSocket: true, // AllowEmptySignature: true, + EnableDebug: true, StartSubREQCliCommand: true, StartSubREQCliCommandCont: true, @@ -328,8 +329,7 @@ func checkREQTailFileTest(stewardServer *server, conf *Configuration, t *testing file := filepath.Join(wd, "test.file") - s := ` - [ + s := `[ { "directory": "tail-files", "fileName": "fileName.result", @@ -340,8 +340,8 @@ func checkREQTailFileTest(stewardServer *server, conf *Configuration, t *testing "retries":3, "methodTimeout": 10 } - ] - ` + ]` + writeToSocketTest(conf, s, t) // time.Sleep(time.Second * 5)