Skip to content

Commit cd6abb7

Browse files
add more info to log message
1 parent 6d428c2 commit cd6abb7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/datastore/target/netconf/xml2SchemapbAdapter.go

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

1717
import (
1818
"context"
19+
"encoding/json"
1920
"fmt"
2021
"strings"
2122

@@ -167,7 +168,11 @@ func (x *XML2sdcpbConfigAdapter) transformField(ctx context.Context, e *etree.El
167168
// process terminal values
168169
tv, err := StringElementToTypedValue(e.Text(), ls)
169170
if err != nil {
170-
return fmt.Errorf("unable to convert value [%s] at path [%s] according to SchemaLeafType [%#v]: %w", e.Text(), e.GetPath(), ls.Type, err)
171+
slt, errMarsh := json.Marshal(ls.Type)
172+
if errMarsh != nil {
173+
return fmt.Errorf("unable to represent leafref as JSON during error generation: %w", errMarsh)
174+
}
175+
return fmt.Errorf("unable to convert value [%s] at path [%s] according to SchemaLeafType [%s]: %w", e.Text(), e.GetPath(), slt, err)
171176
}
172177
// copy pathElems
173178
npelem := make([]*sdcpb.PathElem, 0, len(pelems))

0 commit comments

Comments
 (0)