From e525f5d62a96a572ed401cc08796abfe3c34b2ca Mon Sep 17 00:00:00 2001 From: porosnicuadrian Date: Tue, 15 Mar 2022 15:07:54 +0200 Subject: [PATCH] Changed the error output for exportItems --- tpes/tpe_accounts.go | 3 +-- tpes/tpe_actions.go | 3 +-- tpes/tpe_attributes.go | 3 +-- tpes/tpe_chargers.go | 3 +-- tpes/tpe_filters.go | 3 +-- tpes/tpe_rates.go | 3 +-- tpes/tpe_resources.go | 3 +-- tpes/tpe_routes.go | 3 +-- tpes/tpe_stats.go | 3 +-- 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/tpes/tpe_accounts.go b/tpes/tpe_accounts.go index e73c13ca4..d832808f7 100644 --- a/tpes/tpe_accounts.go +++ b/tpes/tpe_accounts.go @@ -53,8 +53,7 @@ func (tpAcc TPAccounts) exportItems(ctx *context.Context, wrtr io.Writer, tnt st acc, err = tpAcc.dm.GetAccount(ctx, tnt, accID) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find Account with id: <%v>", utils.TPeS, accID)) - continue + return fmt.Errorf("<%s> cannot find Account with id: <%v>", err, accID) } return err } diff --git a/tpes/tpe_actions.go b/tpes/tpe_actions.go index 97f0374a2..a4222013d 100644 --- a/tpes/tpe_actions.go +++ b/tpes/tpe_actions.go @@ -53,8 +53,7 @@ func (tpActs TPActions) exportItems(ctx *context.Context, wrtr io.Writer, tnt st actsPrf, err = tpActs.dm.GetActionProfile(ctx, tnt, actsID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find Actions with id: <%v>", utils.TPeS, actsID)) - continue + return fmt.Errorf("<%s> cannot find Actions id: <%v>", err, actsID) } return err } diff --git a/tpes/tpe_attributes.go b/tpes/tpe_attributes.go index 589891f90..dfbfbcb52 100644 --- a/tpes/tpe_attributes.go +++ b/tpes/tpe_attributes.go @@ -53,8 +53,7 @@ func (tpAttr TPAttributes) exportItems(ctx *context.Context, wrtr io.Writer, tnt attrPrf, err = tpAttr.dm.GetAttributeProfile(ctx, tnt, attrID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find AttributeProfile with id: <%v>", utils.TPeS, attrID)) - continue + return fmt.Errorf("<%s> cannot find AttributeProfile with id: <%v>", err, attrID) } return err } diff --git a/tpes/tpe_chargers.go b/tpes/tpe_chargers.go index b7e183cc6..38338bca9 100644 --- a/tpes/tpe_chargers.go +++ b/tpes/tpe_chargers.go @@ -53,8 +53,7 @@ func (tpChrg TPChargers) exportItems(ctx *context.Context, wrtr io.Writer, tnt s chrgPrf, err = tpChrg.dm.GetChargerProfile(ctx, tnt, chrgID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find ChargerProfile with id: <%v>", utils.TPeS, chrgID)) - continue + return fmt.Errorf("<%s> cannot find ChargerProfile with id: <%v>", err, chrgID) } return err } diff --git a/tpes/tpe_filters.go b/tpes/tpe_filters.go index 86688f551..42985146f 100644 --- a/tpes/tpe_filters.go +++ b/tpes/tpe_filters.go @@ -53,8 +53,7 @@ func (tpFltr TPFilters) exportItems(ctx *context.Context, wrtr io.Writer, tnt st fltr, err = tpFltr.dm.GetFilter(ctx, tnt, fltrID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find Filters with id: <%v>", utils.TPeS, fltrID)) - continue + return fmt.Errorf("<%s> cannot find Filters with id: <%v>", err, fltrID) } return err } diff --git a/tpes/tpe_rates.go b/tpes/tpe_rates.go index 84d3bf881..4e18d17c0 100644 --- a/tpes/tpe_rates.go +++ b/tpes/tpe_rates.go @@ -53,8 +53,7 @@ func (tpRts TPRates) exportItems(ctx *context.Context, wrtr io.Writer, tnt strin ratePrf, err = tpRts.dm.GetRateProfile(ctx, tnt, rateID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find RateProfile with id: <%v>", utils.TPeS, rateID)) - continue + return fmt.Errorf("<%s> cannot find RateProfile with id: <%v>", err, rateID) } return err } diff --git a/tpes/tpe_resources.go b/tpes/tpe_resources.go index 964bd7761..b201e9133 100644 --- a/tpes/tpe_resources.go +++ b/tpes/tpe_resources.go @@ -53,8 +53,7 @@ func (tpRes TPResources) exportItems(ctx *context.Context, wrtr io.Writer, tnt s resPrf, err = tpRes.dm.GetResourceProfile(ctx, tnt, resID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find ResourceProfile with id: <%v>", utils.TPeS, resID)) - continue + return fmt.Errorf("<%s> cannot find ResourceProfile with id: <%v>", err, resID) } return err } diff --git a/tpes/tpe_routes.go b/tpes/tpe_routes.go index 11971f82b..f2f1fc59d 100644 --- a/tpes/tpe_routes.go +++ b/tpes/tpe_routes.go @@ -53,8 +53,7 @@ func (tpRoutes TPRoutes) exportItems(ctx *context.Context, wrtr io.Writer, tnt s routePrf, err = tpRoutes.dm.GetRouteProfile(ctx, tnt, routeID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find RouteProfile with id: <%v>", utils.TPeS, routeID)) - continue + return fmt.Errorf("<%s> cannot find RouteProfile with id: <%v>", err, routeID) } return err } diff --git a/tpes/tpe_stats.go b/tpes/tpe_stats.go index 646856465..b4f452194 100644 --- a/tpes/tpe_stats.go +++ b/tpes/tpe_stats.go @@ -53,8 +53,7 @@ func (tpSts TPStats) exportItems(ctx *context.Context, wrtr io.Writer, tnt strin statPrf, err = tpSts.dm.GetStatQueueProfile(ctx, tnt, statsID, true, true, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> cannot find StatQueueProfile with id: <%v>", utils.TPeS, statsID)) - continue + return fmt.Errorf("<%s> cannot find StatQueueProfile with id: <%v>", err, statsID) } return err }