verbose decode hook errors
diff --git a/mapstructure.go b/mapstructure.go index b0ab9a3..fbf3c24 100644 --- a/mapstructure.go +++ b/mapstructure.go
@@ -202,7 +202,7 @@ d.config.DecodeHook, dataVal.Type(), val.Type(), data) if err != nil { - return err + return fmt.Errorf("error decoding '%s': %s", name, err) } } @@ -547,7 +547,7 @@ valType := val.Type() valElemType := valType.Elem() - realVal:=val + realVal := val if realVal.IsNil() || d.config.ZeroFields { realVal = reflect.New(valElemType) } @@ -567,7 +567,7 @@ valElemType := valType.Elem() sliceType := reflect.SliceOf(valElemType) - valSlice:=val + valSlice := val if valSlice.IsNil() || d.config.ZeroFields { // Check input type