diff --git a/mqmetric/discover.go b/mqmetric/discover.go index e06d106..472077c 100755 --- a/mqmetric/discover.go +++ b/mqmetric/discover.go @@ -472,7 +472,7 @@ cases where multiple pieces of data have to be collated for the same gauge. Conversely, there may be times when this is called but there are no metrics to update. */ -func ProcessPublications() { +func ProcessPublications() error { var err error var data []byte @@ -568,8 +568,16 @@ func ProcessPublications() { elem.Values[objectName] = value } } + } else { + // err != nil + mqreturn := err.(*ibmmq.MQReturn) + + if mqreturn.MQCC == ibmmq.MQCC_FAILED && mqreturn.MQRC != ibmmq.MQRC_NO_MSG_AVAILABLE { + return mqreturn + } } } + return nil } /* diff --git a/mqmetric/mqif.go b/mqmetric/mqif.go index 5449d8b..5820fa9 100644 --- a/mqmetric/mqif.go +++ b/mqmetric/mqif.go @@ -180,7 +180,6 @@ func getMessage(wait bool) ([]byte, error) { func getMessageWithHObj(wait bool, hObj ibmmq.MQObject) ([]byte, error) { var err error var datalen int - var mqreturn *ibmmq.MQReturn getmqmd := ibmmq.NewMQMD() gmo := ibmmq.NewMQGMO() @@ -196,18 +195,6 @@ func getMessageWithHObj(wait bool, hObj ibmmq.MQObject) ([]byte, error) { } datalen, err = replyQObj.Get(getmqmd, gmo, getBuffer) - if err != nil { - mqreturn = err.(*ibmmq.MQReturn) - - if mqreturn.MQRC == ibmmq.MQRC_Q_MGR_NOT_AVAILABLE || - mqreturn.MQRC == ibmmq.MQRC_Q_MGR_NAME_ERROR || - mqreturn.MQRC == ibmmq.MQRC_Q_MGR_QUIESCING { - return nil, fmt.Errorf("Queue Manager error: %v", err) - } - if mqreturn.MQCC == ibmmq.MQCC_FAILED && mqreturn.MQRC != ibmmq.MQRC_NO_MSG_AVAILABLE { - return nil, fmt.Errorf("Get message error: %v", err) - } - } return getBuffer[0:datalen], err }