|
@@ -2,9 +2,11 @@ package request
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"git.sxidc.com/go-tools/api_binding/mqtt_binding/mqtt_client"
|
|
|
"git.sxidc.com/go-tools/api_binding/mqtt_binding/mqtt_client/router"
|
|
|
"git.sxidc.com/go-tools/api_binding/mqtt_binding/response"
|
|
|
+ "git.sxidc.com/service-supports/fslog"
|
|
|
"github.com/go-playground/validator/v10"
|
|
|
)
|
|
|
|
|
@@ -25,12 +27,16 @@ func BindingJson[O any](c *mqtt_client.MqttClient, item *router.Item, request an
|
|
|
if responseIdentifier != nil {
|
|
|
err := json.Unmarshal(data, responseIdentifier)
|
|
|
if err != nil {
|
|
|
- panic(err)
|
|
|
+ err := errors.New("Topic: " + item.Topic + " Response Identifier Unmarshal Error: " + err.Error())
|
|
|
+ fslog.Error(err)
|
|
|
+ return false
|
|
|
}
|
|
|
|
|
|
err = validate.Struct(responseIdentifier)
|
|
|
if err != nil {
|
|
|
- panic(err)
|
|
|
+ err := errors.New("Topic: " + item.Topic + " Response Identifier Validate Error: " + err.Error())
|
|
|
+ fslog.Error(err)
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
|