mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
wrap error to make the message clear
This commit is contained in:
parent
8cc5db7506
commit
f4066b18b3
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user