From c79df889af9c7c952d5c00f07b61831b772d5d11 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Fri, 20 Oct 2023 16:21:31 -0400 Subject: [PATCH] WIP --- yaml.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yaml.go b/yaml.go index 39d8c24..031d004 100644 --- a/yaml.go +++ b/yaml.go @@ -110,13 +110,13 @@ func JSONToYAML(j []byte) ([]byte, error) { // number type, so we can preserve number type throughout this process. err := yaml.Unmarshal(j, &jsonObj) if err != nil { - return nil, fmt.Errorf("error converting JSON to YAML: %w", err) + return nil, err } // Marshal this object into YAML. yamlBytes, err := yaml.Marshal(jsonObj) if err != nil { - return nil, fmt.Errorf("error converting JSON to YAML: %w", err) + return nil, err } return yamlBytes, nil @@ -155,7 +155,7 @@ func yamlToJSONTarget(yamlBytes []byte, jsonTarget *reflect.Value, unmarshalFn f var yamlObj interface{} err := unmarshalFn(yamlBytes, &yamlObj) if err != nil { - return nil, fmt.Errorf("error converting YAML to JSON: %w", err) + return nil, err } // YAML objects are not completely compatible with JSON objects (e.g. you @@ -164,13 +164,13 @@ func yamlToJSONTarget(yamlBytes []byte, jsonTarget *reflect.Value, unmarshalFn f // incompatibilties happen along the way. jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) if err != nil { - return nil, fmt.Errorf("error converting YAML to JSON: %w", err) + return nil, err } // Convert this object to JSON and return the data. jsonBytes, err := json.Marshal(jsonObj) if err != nil { - return nil, fmt.Errorf("error converting YAML to JSON: %w", err) + return nil, err } return jsonBytes, nil }