From 9a639f394364242398b58301e78c9d93b65752ea Mon Sep 17 00:00:00 2001 From: Andrew Stone Date: Wed, 17 Oct 2018 13:30:14 -0700 Subject: [PATCH] parse{num}: Return the error from strconv.NumError 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. --- parse.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parse.go b/parse.go index 8e25719..3050c48 100644 --- a/parse.go +++ b/parse.go @@ -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, } } @@ -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, } } @@ -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, } }