Skip to content

Commit

Permalink
improve error message for invalid map value decode
Browse files Browse the repository at this point in the history
  • Loading branch information
guregu committed Jul 3, 2024
1 parent 06919cf commit 58b8919
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion decodefunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func decodeMap(decodeKey func(reflect.Value, string) error) func(plan *typedef,
}
innerRV := reflect.New(rv.Type().Elem())
if err := plan.decodeAttr(flags, v, innerRV.Elem()); err != nil {
return fmt.Errorf("error decoding key %q into %v", name, kp.Type().Elem())
return fmt.Errorf("error decoding map entry %q (%s) into type %v", name, avTypeName(v), innerRV.Type().Elem())
}
rv.SetMapIndex(kp.Elem(), innerRV.Elem())
}
Expand Down

0 comments on commit 58b8919

Please sign in to comment.