chore: make error message more readable (#3154)

master
Kevin Wan 2 years ago committed by GitHub
parent 489d69f779
commit 02357d2616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -881,9 +881,11 @@ func (u *Unmarshaler) unmarshalWithFullName(m valuerWithParent, v any, fullName
typeField := baseType.Field(i)
valueField := valElem.Field(i)
if err := u.processField(typeField, valueField, m, fullName); err != nil {
if fullName != "" {
err = fmt.Errorf("%s, fullName :%s, typeField :%s, valueField :%s", err.Error(), fullName, typeField.Name, valueField.Type())
if len(fullName) > 0 {
err = fmt.Errorf("%w, fullName: %s, field: %s, type: %s",
err, fullName, typeField.Name, valueField.Type().Name())
}
return err
}
}

Loading…
Cancel
Save