diff --git a/encoding/encoding.go b/encoding/encoding.go index 24fa378c..8f980de5 100644 --- a/encoding/encoding.go +++ b/encoding/encoding.go @@ -3,6 +3,7 @@ package encoding import ( "encoding/json" + "github.com/layer5io/meshkit/utils" "gopkg.in/yaml.v2" ) @@ -49,3 +50,15 @@ func unmarshalJSON(data []byte, result interface{}) error { } return nil } + +func Marshal(in interface{}) ([]byte, error) { + result, err := json.Marshal(in) + if err != nil { + result, err = yaml.Marshal(in) + if err != nil { + return nil, utils.ErrMarshal(err) + } + } + + return result, nil +} diff --git a/models/meshmodel/registry/registry.go b/models/meshmodel/registry/registry.go index 459ab7c3..cc9d1c1b 100644 --- a/models/meshmodel/registry/registry.go +++ b/models/meshmodel/registry/registry.go @@ -81,13 +81,11 @@ func (rm *RegistryManager) Cleanup() { func (rm *RegistryManager) RegisterEntity(h connection.Connection, en entity.Entity) (bool, bool, error) { registrantID, err := h.Create(rm.db) if err != nil { - fmt.Println("REGISTRANT ERROR ") return true, false, err } entityID, err := en.Create(rm.db, registrantID) if err != nil { - fmt.Println("COMP ERROR ") return false, true, err } id, _ := uuid.NewV4()