code refactor

This commit is contained in:
MaysWind
2023-03-26 22:24:26 +08:00
parent 8d5de98218
commit 27f4e14a4e
6 changed files with 35 additions and 35 deletions
+4 -4
View File
@@ -38,7 +38,7 @@ func (a *AccountsApi) AccountListHandler(c *core.Context) (interface{}, *errs.Er
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[accounts.AccountListHandler] failed to get all accounts for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[accounts.AccountListHandler] failed to get all accounts for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
userAllAccountResps := make([]*models.AccountInfoResponse, len(accounts)) userAllAccountResps := make([]*models.AccountInfoResponse, len(accounts))
@@ -98,7 +98,7 @@ func (a *AccountsApi) AccountGetHandler(c *core.Context) (interface{}, *errs.Err
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[accounts.AccountGetHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", accountGetReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[accounts.AccountGetHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", accountGetReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
accountRespMap := make(map[int64]*models.AccountInfoResponse) accountRespMap := make(map[int64]*models.AccountInfoResponse)
@@ -190,7 +190,7 @@ func (a *AccountsApi) AccountCreateHandler(c *core.Context) (interface{}, *errs.
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[accounts.AccountCreateHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[accounts.AccountCreateHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
mainAccount := a.createNewAccountModel(uid, &accountCreateReq, maxOrderId+1) mainAccount := a.createNewAccountModel(uid, &accountCreateReq, maxOrderId+1)
@@ -233,7 +233,7 @@ func (a *AccountsApi) AccountModifyHandler(c *core.Context) (interface{}, *errs.
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[accounts.AccountModifyHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", accountModifyReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[accounts.AccountModifyHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", accountModifyReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
accountMap := a.accounts.GetAccountMapByList(accountAndSubAccounts) accountMap := a.accounts.GetAccountMapByList(accountAndSubAccounts)
+3 -3
View File
@@ -147,21 +147,21 @@ func (a *DataManagementsApi) ClearDataHandler(c *core.Context) (interface{}, *er
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[data_managements.ClearDataHandler] failed to delete all transactions, because %s", err.Error()) log.ErrorfWithRequestId(c, "[data_managements.ClearDataHandler] failed to delete all transactions, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
err = a.categories.DeleteAllCategories(uid) err = a.categories.DeleteAllCategories(uid)
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[data_managements.ClearDataHandler] failed to delete all transaction categories, because %s", err.Error()) log.ErrorfWithRequestId(c, "[data_managements.ClearDataHandler] failed to delete all transaction categories, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
err = a.tags.DeleteAllTags(uid) err = a.tags.DeleteAllTags(uid)
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[data_managements.ClearDataHandler] failed to delete all transaction tags, because %s", err.Error()) log.ErrorfWithRequestId(c, "[data_managements.ClearDataHandler] failed to delete all transaction tags, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
log.InfofWithRequestId(c, "[data_managements.ClearDataHandler] user \"uid:%d\" has cleared all data", uid) log.InfofWithRequestId(c, "[data_managements.ClearDataHandler] user \"uid:%d\" has cleared all data", uid)
+2 -2
View File
@@ -32,7 +32,7 @@ func (a *TokensApi) TokenListHandler(c *core.Context) (interface{}, *errs.Error)
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[tokens.TokenListHandler] failed to get all tokens for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[tokens.TokenListHandler] failed to get all tokens for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
tokenResps := make(models.TokenInfoResponseSlice, len(tokens)) tokenResps := make(models.TokenInfoResponseSlice, len(tokens))
@@ -145,7 +145,7 @@ func (a *TokensApi) TokenRevokeAllHandler(c *core.Context) (interface{}, *errs.E
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[tokens.TokenRevokeAllHandler] failed to get all tokens for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[tokens.TokenRevokeAllHandler] failed to get all tokens for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
claims := c.GetTokenClaims() claims := c.GetTokenClaims()
+5 -5
View File
@@ -37,7 +37,7 @@ func (a *TransactionCategoriesApi) CategoryListHandler(c *core.Context) (interfa
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_categories.CategoryListHandler] failed to get categories for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_categories.CategoryListHandler] failed to get categories for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
return a.getTransactionCategoryListByTypeResponse(categories, categoryListReq.ParentId) return a.getTransactionCategoryListByTypeResponse(categories, categoryListReq.ParentId)
@@ -58,7 +58,7 @@ func (a *TransactionCategoriesApi) CategoryGetHandler(c *core.Context) (interfac
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_categories.CategoryGetHandler] failed to get category \"id:%d\" for user \"uid:%d\", because %s", categoryGetReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_categories.CategoryGetHandler] failed to get category \"id:%d\" for user \"uid:%d\", because %s", categoryGetReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
categoryResp := category.ToTransactionCategoryInfoResponse() categoryResp := category.ToTransactionCategoryInfoResponse()
@@ -112,7 +112,7 @@ func (a *TransactionCategoriesApi) CategoryCreateHandler(c *core.Context) (inter
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_categories.CategoryCreateHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_categories.CategoryCreateHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
category := a.createNewCategoryModel(uid, &categoryCreateReq, maxOrderId+1) category := a.createNewCategoryModel(uid, &categoryCreateReq, maxOrderId+1)
@@ -157,7 +157,7 @@ func (a *TransactionCategoriesApi) CategoryCreateBatchHandler(c *core.Context) (
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_categories.CategoryCreateBatchHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_categories.CategoryCreateBatchHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
} }
@@ -208,7 +208,7 @@ func (a *TransactionCategoriesApi) CategoryModifyHandler(c *core.Context) (inter
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_categories.CategoryModifyHandler] failed to get category \"id:%d\" for user \"uid:%d\", because %s", categoryModifyReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_categories.CategoryModifyHandler] failed to get category \"id:%d\" for user \"uid:%d\", because %s", categoryModifyReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
newCategory := &models.TransactionCategory{ newCategory := &models.TransactionCategory{
+4 -4
View File
@@ -29,7 +29,7 @@ func (a *TransactionTagsApi) TagListHandler(c *core.Context) (interface{}, *errs
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_tags.TagListHandler] failed to get tags for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_tags.TagListHandler] failed to get tags for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
tagResps := make(models.TransactionTagInfoResponseSlice, len(tags)) tagResps := make(models.TransactionTagInfoResponseSlice, len(tags))
@@ -58,7 +58,7 @@ func (a *TransactionTagsApi) TagGetHandler(c *core.Context) (interface{}, *errs.
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_tags.TagGetHandler] failed to get tag \"id:%d\" for user \"uid:%d\", because %s", tagGetReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_tags.TagGetHandler] failed to get tag \"id:%d\" for user \"uid:%d\", because %s", tagGetReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
tagResp := tag.ToTransactionTagInfoResponse() tagResp := tag.ToTransactionTagInfoResponse()
@@ -82,7 +82,7 @@ func (a *TransactionTagsApi) TagCreateHandler(c *core.Context) (interface{}, *er
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_tags.TagCreateHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_tags.TagCreateHandler] failed to get max display order for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
tag := a.createNewTagModel(uid, &tagCreateReq, maxOrderId+1) tag := a.createNewTagModel(uid, &tagCreateReq, maxOrderId+1)
@@ -116,7 +116,7 @@ func (a *TransactionTagsApi) TagModifyHandler(c *core.Context) (interface{}, *er
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transaction_tags.TagModifyHandler] failed to get tag \"id:%d\" for user \"uid:%d\", because %s", tagModifyReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[transaction_tags.TagModifyHandler] failed to get tag \"id:%d\" for user \"uid:%d\", because %s", tagModifyReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
newTag := &models.TransactionTag{ newTag := &models.TransactionTag{
+17 -17
View File
@@ -50,14 +50,14 @@ func (a *TransactionsApi) TransactionCountHandler(c *core.Context) (interface{},
if err != nil { if err != nil {
log.WarnfWithRequestId(c, "[transactions.TransactionCountHandler] get account error, because %s", err.Error()) log.WarnfWithRequestId(c, "[transactions.TransactionCountHandler] get account error, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
allCategoryIds, err := a.getCategoryOrSubCategoryIds(transactionCountReq.CategoryId, uid) allCategoryIds, err := a.getCategoryOrSubCategoryIds(transactionCountReq.CategoryId, uid)
if err != nil { if err != nil {
log.WarnfWithRequestId(c, "[transactions.TransactionCountHandler] get transaction category error, because %s", err.Error()) log.WarnfWithRequestId(c, "[transactions.TransactionCountHandler] get transaction category error, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
totalCount, err := a.transactions.GetTransactionCount(uid, transactionCountReq.MaxTime, transactionCountReq.MinTime, transactionCountReq.Type, allCategoryIds, allAccountIds, transactionCountReq.Keyword) totalCount, err := a.transactions.GetTransactionCount(uid, transactionCountReq.MaxTime, transactionCountReq.MinTime, transactionCountReq.Type, allCategoryIds, allAccountIds, transactionCountReq.Keyword)
@@ -101,21 +101,21 @@ func (a *TransactionsApi) TransactionListHandler(c *core.Context) (interface{},
if err != nil { if err != nil {
log.WarnfWithRequestId(c, "[transactions.TransactionListHandler] get account error, because %s", err.Error()) log.WarnfWithRequestId(c, "[transactions.TransactionListHandler] get account error, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
allCategoryIds, err := a.getCategoryOrSubCategoryIds(transactionListReq.CategoryId, uid) allCategoryIds, err := a.getCategoryOrSubCategoryIds(transactionListReq.CategoryId, uid)
if err != nil { if err != nil {
log.WarnfWithRequestId(c, "[transactions.TransactionListHandler] get transaction category error, because %s", err.Error()) log.WarnfWithRequestId(c, "[transactions.TransactionListHandler] get transaction category error, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
transactions, err := a.transactions.GetTransactionsByMaxTime(uid, transactionListReq.MaxTime, transactionListReq.MinTime, transactionListReq.Type, allCategoryIds, allAccountIds, transactionListReq.Keyword, transactionListReq.Count+1, true) transactions, err := a.transactions.GetTransactionsByMaxTime(uid, transactionListReq.MaxTime, transactionListReq.MinTime, transactionListReq.Type, allCategoryIds, allAccountIds, transactionListReq.Keyword, transactionListReq.Count+1, true)
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionListHandler] failed to get transactions earlier than \"%d\" for user \"uid:%d\", because %s", transactionListReq.MaxTime, uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionListHandler] failed to get transactions earlier than \"%d\" for user \"uid:%d\", because %s", transactionListReq.MaxTime, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
hasMore := false hasMore := false
@@ -177,28 +177,28 @@ func (a *TransactionsApi) TransactionMonthListHandler(c *core.Context) (interfac
if err != nil { if err != nil {
log.WarnfWithRequestId(c, "[transactions.TransactionMonthListHandler] get account error, because %s", err.Error()) log.WarnfWithRequestId(c, "[transactions.TransactionMonthListHandler] get account error, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
allCategoryIds, err := a.getCategoryOrSubCategoryIds(transactionListReq.CategoryId, uid) allCategoryIds, err := a.getCategoryOrSubCategoryIds(transactionListReq.CategoryId, uid)
if err != nil { if err != nil {
log.WarnfWithRequestId(c, "[transactions.TransactionMonthListHandler] get transaction category error, because %s", err.Error()) log.WarnfWithRequestId(c, "[transactions.TransactionMonthListHandler] get transaction category error, because %s", err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
transactions, err := a.transactions.GetTransactionsInMonthByPage(uid, transactionListReq.Year, transactionListReq.Month, transactionListReq.Type, allCategoryIds, allAccountIds, transactionListReq.Keyword, transactionListReq.Page, transactionListReq.Count, utcOffset) transactions, err := a.transactions.GetTransactionsInMonthByPage(uid, transactionListReq.Year, transactionListReq.Month, transactionListReq.Type, allCategoryIds, allAccountIds, transactionListReq.Keyword, transactionListReq.Page, transactionListReq.Count, utcOffset)
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionMonthListHandler] failed to get transactions in month \"%d-%d\" for user \"uid:%d\", because %s", transactionListReq.Year, transactionListReq.Month, uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionMonthListHandler] failed to get transactions in month \"%d-%d\" for user \"uid:%d\", because %s", transactionListReq.Year, transactionListReq.Month, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
totalCount, err := a.transactions.GetMonthTransactionCount(uid, transactionListReq.Year, transactionListReq.Month, transactionListReq.Type, allCategoryIds, allAccountIds, transactionListReq.Keyword, utcOffset) totalCount, err := a.transactions.GetMonthTransactionCount(uid, transactionListReq.Year, transactionListReq.Month, transactionListReq.Type, allCategoryIds, allAccountIds, transactionListReq.Keyword, utcOffset)
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionMonthListHandler] failed to get transaction count in month \"%d-%d\" for user \"uid:%d\", because %s", transactionListReq.Year, transactionListReq.Month, uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionMonthListHandler] failed to get transaction count in month \"%d-%d\" for user \"uid:%d\", because %s", transactionListReq.Year, transactionListReq.Month, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
transactionResult, err := a.getTransactionListResult(c, user, transactions, utcOffset, transactionListReq.TrimAccount, transactionListReq.TrimCategory, transactionListReq.TrimTag) transactionResult, err := a.getTransactionListResult(c, user, transactions, utcOffset, transactionListReq.TrimAccount, transactionListReq.TrimCategory, transactionListReq.TrimTag)
@@ -282,7 +282,7 @@ func (a *TransactionsApi) TransactionAmountsHandler(c *core.Context) (interface{
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionAmountsHandler] failed to get all accounts for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionAmountsHandler] failed to get all accounts for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
amountsResp := make(map[string]*models.TransactionAmountsResponseItem) amountsResp := make(map[string]*models.TransactionAmountsResponseItem)
@@ -294,7 +294,7 @@ func (a *TransactionsApi) TransactionAmountsHandler(c *core.Context) (interface{
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionAmountsHandler] failed to get transaction amounts item for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionAmountsHandler] failed to get transaction amounts item for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
amountsMap := make(map[string]*models.TransactionAmountsResponseItemAmountInfo) amountsMap := make(map[string]*models.TransactionAmountsResponseItemAmountInfo)
@@ -390,7 +390,7 @@ func (a *TransactionsApi) TransactionMonthAmountsHandler(c *core.Context) (inter
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionMonthAmountsHandler] failed to get all accounts for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionMonthAmountsHandler] failed to get all accounts for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
totalAmounts, err := a.transactions.GetAccountsMonthTotalIncomeAndExpense(uid, startTime, endTime, pageCountForLoadTransactionAmounts) totalAmounts, err := a.transactions.GetAccountsMonthTotalIncomeAndExpense(uid, startTime, endTime, pageCountForLoadTransactionAmounts)
@@ -497,7 +497,7 @@ func (a *TransactionsApi) TransactionGetHandler(c *core.Context) (interface{}, *
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transaction \"id:%d\" for user \"uid:%d\", because %s", transactionGetReq.Id, uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transaction \"id:%d\" for user \"uid:%d\", because %s", transactionGetReq.Id, uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
if transaction.Type == models.TRANSACTION_DB_TYPE_TRANSFER_IN { if transaction.Type == models.TRANSACTION_DB_TYPE_TRANSFER_IN {
@@ -530,7 +530,7 @@ func (a *TransactionsApi) TransactionGetHandler(c *core.Context) (interface{}, *
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transactions tag ids for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transactions tag ids for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
var category *models.TransactionCategory var category *models.TransactionCategory
@@ -541,7 +541,7 @@ func (a *TransactionsApi) TransactionGetHandler(c *core.Context) (interface{}, *
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transactions category for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transactions category for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
} }
@@ -550,7 +550,7 @@ func (a *TransactionsApi) TransactionGetHandler(c *core.Context) (interface{}, *
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transactions tags for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionGetHandler] failed to get transactions tags for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
} }
@@ -697,7 +697,7 @@ func (a *TransactionsApi) TransactionModifyHandler(c *core.Context) (interface{}
if err != nil { if err != nil {
log.ErrorfWithRequestId(c, "[transactions.TransactionModifyHandler] failed to get transactions tag ids for user \"uid:%d\", because %s", uid, err.Error()) log.ErrorfWithRequestId(c, "[transactions.TransactionModifyHandler] failed to get transactions tag ids for user \"uid:%d\", because %s", uid, err.Error())
return nil, errs.ErrOperationFailed return nil, errs.Or(err, errs.ErrOperationFailed)
} }
transactionTagIds := allTransactionTagIds[transaction.TransactionId] transactionTagIds := allTransactionTagIds[transaction.TransactionId]