From 956af8bee38b7884f116e079d55612bc8f2366b3 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, } }