This commit is contained in:
shoopea 2019-05-03 15:45:25 +08:00
parent 8894b7b645
commit 477fad6086
2 changed files with 9 additions and 3 deletions

4
mq.go
View File

@ -44,8 +44,8 @@ func MQMainReceive() {
for d := range msgs {
log.Printf("MQMainReceive : Received a message: %s", d.Body)
if err = json.Unmarshal(d.Body, &m); err != nil {
failOnError(err, "MQMainReceive : Can't unmarshal")
}
logOnError(err, "MQMainReceive : Can't unmarshal")
} else {
putMsg(m)
}
}()

View File

@ -9,3 +9,9 @@ func failOnError(err error, msg string) {
log.Fatalf("%s: %s", msg, err)
}
}
func logOnError(err error, msg string) {
if err != nil {
log.Printf("%s: %s", msg, err)
}
}