config: Don't expose go implementation details in Resource.Count

Previously we would return the raw error from strconv.ParseInt, which
includes details in its text that expose implementation details and are
thus not helpful to the user.

Instead, we use a locally-defined error message that talks only about
what the caller is expected to know: that count should be parsable as
an integer.
pull/17552/head
Martin Atkins 8 years ago
parent 48517fbab4
commit 5b08fd4f9f

@ -231,7 +231,10 @@ func (r *Resource) Count() (int, error) {
v, err := strconv.ParseInt(count, 0, 0)
if err != nil {
return 0, err
return 0, fmt.Errorf(
"cannot parse %q as an integer",
count,
)
}
return int(v), nil

Loading…
Cancel
Save