mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 23:16:53 +00:00
Engine/ExchangeManager: Return error for method GetExchangeByName (#760)
* engine: Add error returns * engine: after merge fixes * engine: remove interface * linter: fix shadow declarations * engine: fix tests * niterinos: fixed * GLORIOUS NITS!
This commit is contained in:
@@ -32,9 +32,9 @@ func (m *WithdrawManager) SubmitWithdrawal(req *withdraw.Request) (*withdraw.Res
|
||||
return nil, withdraw.ErrRequestCannotBeNil
|
||||
}
|
||||
|
||||
exch := m.exchangeManager.GetExchangeByName(req.Exchange)
|
||||
if exch == nil {
|
||||
return nil, ErrExchangeNotFound
|
||||
exch, err := m.exchangeManager.GetExchangeByName(req.Exchange)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &withdraw.Response{
|
||||
@@ -44,7 +44,6 @@ func (m *WithdrawManager) SubmitWithdrawal(req *withdraw.Request) (*withdraw.Res
|
||||
RequestDetails: *req,
|
||||
}
|
||||
|
||||
var err error
|
||||
if m.isDryRun {
|
||||
log.Warnln(log.Global, "Dry run enabled, no withdrawal request will be submitted or have an event created")
|
||||
resp.ID = withdraw.DryRunID
|
||||
@@ -108,9 +107,9 @@ func (m *WithdrawManager) WithdrawalEventByExchange(exchange string, limit int)
|
||||
if m == nil {
|
||||
return nil, ErrNilSubsystem
|
||||
}
|
||||
exch := m.exchangeManager.GetExchangeByName(exchange)
|
||||
if exch == nil {
|
||||
return nil, ErrExchangeNotFound
|
||||
_, err := m.exchangeManager.GetExchangeByName(exchange)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return dbwithdraw.GetEventsByExchange(exchange, limit)
|
||||
@@ -121,9 +120,9 @@ func (m *WithdrawManager) WithdrawEventByDate(exchange string, start, end time.T
|
||||
if m == nil {
|
||||
return nil, ErrNilSubsystem
|
||||
}
|
||||
exch := m.exchangeManager.GetExchangeByName(exchange)
|
||||
if exch == nil {
|
||||
return nil, ErrExchangeNotFound
|
||||
_, err := m.exchangeManager.GetExchangeByName(exchange)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return dbwithdraw.GetEventsByDate(exchange, start, end, limit)
|
||||
@@ -134,9 +133,9 @@ func (m *WithdrawManager) WithdrawalEventByExchangeID(exchange, id string) (*wit
|
||||
if m == nil {
|
||||
return nil, ErrNilSubsystem
|
||||
}
|
||||
exch := m.exchangeManager.GetExchangeByName(exchange)
|
||||
if exch == nil {
|
||||
return nil, ErrExchangeNotFound
|
||||
_, err := m.exchangeManager.GetExchangeByName(exchange)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return dbwithdraw.GetEventByExchangeID(exchange, id)
|
||||
|
||||
Reference in New Issue
Block a user