Skip to content

Commit

Permalink
parse{num}: Return the error from strconv.NumError
Browse files Browse the repository at this point in the history
Returning the full error just adds extra noise to the error since it's
already clear that there was an error with the number. This now says
exactly what is wrong with the number.
  • Loading branch information
thatguystone committed Oct 17, 2018
1 parent 5508f04 commit 956af8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func parseInt(key, keytail string, values []string, target reflect.Value) error
return TypeError{
Key: kpath(key, keytail),
Type: t,
Err: err,
Err: err.(*strconv.NumError).Err,
}
}

Expand All @@ -171,7 +171,7 @@ func parseUint(key, keytail string, values []string, target reflect.Value) error
return TypeError{
Key: kpath(key, keytail),
Type: t,
Err: err,
Err: err.(*strconv.NumError).Err,
}
}

Expand All @@ -191,7 +191,7 @@ func parseFloat(key, keytail string, values []string, target reflect.Value) erro
return TypeError{
Key: kpath(key, keytail),
Type: t,
Err: err,
Err: err.(*strconv.NumError).Err,
}
}

Expand Down

0 comments on commit 956af8b

Please sign in to comment.