1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

sending error on not defined request types

This commit is contained in:
postmannen 2021-09-17 10:28:48 +02:00
parent 054455b857
commit c9eb267f4e
2 changed files with 3 additions and 1 deletions

View file

@ -185,6 +185,7 @@ func (s startup) pubREQHello(p process) {
sam, err := newSubjectAndMessage(m)
if err != nil {
// In theory the system should drop the message before it reaches here.
sendErrorLogMessage(proc.configuration, s.metrics, proc.toRingbufferCh, Node(proc.node), err)
log.Printf("error: ProcessesStart: %v\n", err)
}
proc.toRingbufferCh <- []subjectAndMessage{sam}

View file

@ -232,6 +232,7 @@ func (s *server) convertBytesToSAMs(b []byte) ([]subjectAndMessage, error) {
for _, m := range MsgSlice {
sm, err := newSubjectAndMessage(m)
if err != nil {
sendErrorLogMessage(s.configuration, s.metrics, s.newMessagesCh, Node(s.nodeName), err)
log.Printf("error: jsonFromFileData: %v\n", err)
continue
}
@ -296,7 +297,7 @@ func newSubjectAndMessage(m Message) (subjectAndMessage, error) {
tmpH := mt.getHandler(m.Method)
if tmpH == nil {
return subjectAndMessage{}, fmt.Errorf("error: no such request type defined: %v", tmpH)
return subjectAndMessage{}, fmt.Errorf("error: no such request type defined: %v", m.Method)
}
sub := Subject{