Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mayswind committed Nov 14, 2024
1 parent 835b3b7 commit 89bd055
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/api/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,22 @@ func (a *AccountsApi) AccountCreateHandler(c *core.WebContext) (any, *errs.Error
subAccount := accountCreateReq.SubAccounts[i]

if subAccount.Category != accountCreateReq.Category {
log.Warnf(c, "[accounts.AccountCreateHandler] category of sub-account not equals to parent")
log.Warnf(c, "[accounts.AccountCreateHandler] category of sub-account#%d not equals to parent", i)
return nil, errs.ErrSubAccountCategoryNotEqualsToParent
}

if subAccount.Type != models.ACCOUNT_TYPE_SINGLE_ACCOUNT {
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account type invalid")
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account#%d type invalid", i)
return nil, errs.ErrSubAccountTypeInvalid
}

if subAccount.Currency == validators.ParentAccountCurrencyPlaceholder {
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account cannot set currency placeholder")
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account#%d cannot set currency placeholder", i)
return nil, errs.ErrAccountCurrencyInvalid
}

if subAccount.Balance != 0 && subAccount.BalanceTime <= 0 {
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account balance time is not set")
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account#%d balance time is not set", i)
return nil, errs.ErrAccountBalanceTimeNotSet
}
}
Expand Down

0 comments on commit 89bd055

Please sign in to comment.