mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 15:10:13 +00:00
common: update Errors type (#1129)
* common: adjust common error slice to allow multi errors.Is matching and conform to interface better * zb: forgot to save? * linties: fixies * linties: word change as well. * nitters: glorious * buts * nitters: fix glorious bug * Update common/common.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * nitters: shifty --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -1109,18 +1109,14 @@ func (c *Cancel) Validate(opt ...validate.Checker) error {
|
||||
return ErrCancelOrderIsNil
|
||||
}
|
||||
|
||||
var errs common.Errors
|
||||
var errs error
|
||||
for _, o := range opt {
|
||||
err := o.Check()
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
errs = common.AppendError(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if errs != nil {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate checks internal struct requirements and returns filter requirement
|
||||
@@ -1142,17 +1138,14 @@ func (g *GetOrdersRequest) Validate(opt ...validate.Checker) error {
|
||||
return errUnrecognisedOrderType
|
||||
}
|
||||
|
||||
var errs common.Errors
|
||||
var errs error
|
||||
for _, o := range opt {
|
||||
err := o.Check()
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
errs = common.AppendError(errs, err)
|
||||
}
|
||||
}
|
||||
if errs != nil {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
return errs
|
||||
}
|
||||
|
||||
// Filter reduces slice by optional fields
|
||||
@@ -1183,14 +1176,13 @@ func (m *Modify) Validate(opt ...validate.Checker) error {
|
||||
return ErrAssetNotSet
|
||||
}
|
||||
|
||||
var errs common.Errors
|
||||
var errs error
|
||||
for _, o := range opt {
|
||||
err := o.Check()
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
errs = common.AppendError(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if errs != nil {
|
||||
return errs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user