Changed the error output for exportItems

This commit is contained in:
porosnicuadrian
2022-03-15 15:07:54 +02:00
committed by Dan Christian Bogos
parent 07f697edeb
commit e525f5d62a
9 changed files with 9 additions and 18 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}