wrap error to make the message clear

This commit is contained in:
c9s 2020-10-20 14:15:12 +08:00
parent 8cc5db7506
commit f4066b18b3

View File

@ -45,15 +45,15 @@ func LoadExchangeStrategies(configFile string) (strategies []bbgo.SingleExchange
val := reflect.New(rt) val := reflect.New(rt)
// now we have &(*Strategy) -> **Strategy // now we have &(*Strategy) -> **Strategy
valinf := val.Interface() valRef := val.Interface()
plain, err := json.Marshal(conf) plain, err := json.Marshal(conf)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := json.Unmarshal(plain, valinf); err != nil { if err := json.Unmarshal(plain, valRef); err != nil {
return nil, err return nil, errors.Wrapf(err, "json parsing error, given payload: %s", plain)
} }
strategies = append(strategies, val.Elem().Interface().(bbgo.SingleExchangeStrategy)) strategies = append(strategies, val.Elem().Interface().(bbgo.SingleExchangeStrategy))