Skip to content

Commit 3a44c38

Browse files
fix error report of type conversion
1 parent b0b9bed commit 3a44c38

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

pkg/datastore/target/netconf/xml2SchemapbAdapter.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package netconf
1616

1717
import (
1818
"context"
19-
"encoding/json"
2019
"fmt"
2120
"strings"
2221

@@ -177,11 +176,7 @@ func (x *XML2sdcpbConfigAdapter) transformField(ctx context.Context, e *etree.El
177176
// process terminal values
178177
tv, err := utils.Convert(e.Text(), schemaLeafType)
179178
if err != nil {
180-
slt, errMarsh := json.Marshal(ls.Type)
181-
if errMarsh != nil {
182-
return fmt.Errorf("unable to represent leafref as JSON during error generation: %w", errMarsh)
183-
}
184-
return fmt.Errorf("unable to convert value [%s] at path [%s] according to SchemaLeafType [%s]: %w", e.Text(), e.GetPath(), slt, err)
179+
return fmt.Errorf("unable to convert value [%s] at path [%s] according to SchemaLeafType [%+v]: %w", e.Text(), e.GetPath(), schemaLeafType, err)
185180
}
186181
// copy pathElems
187182
npelem := make([]*sdcpb.PathElem, 0, len(pelems))

0 commit comments

Comments
 (0)