Changed the format for IDs from %s to %q

This commit is contained in:
nickolasdaniel
2021-07-05 16:18:41 +03:00
committed by Dan Christian Bogos
parent cd7119c1ef
commit 11d2fb7e00

View File

@@ -231,7 +231,7 @@ func (tpr *TpReader) LoadDestinationRates() (err error) {
for _, dr := range drs.DestinationRates {
rate, exists := tpr.rates[dr.RateId]
if !exists {
return fmt.Errorf("could not find rate for tag %v", dr.RateId)
return fmt.Errorf("could not find rate for tag %q", dr.RateId)
}
dr.Rate = rate
destinationExists := dr.DestinationId == utils.ANY
@@ -244,7 +244,7 @@ func (tpr *TpReader) LoadDestinationRates() (err error) {
}
}
if !destinationExists {
return fmt.Errorf("could not get destination for tag %v", dr.DestinationId)
return fmt.Errorf("could not get destination for tag %q", dr.DestinationId)
}
}
}
@@ -270,7 +270,7 @@ func (tpr *TpReader) LoadRatingPlansFiltered(tag string) (bool, error) {
if !exists {
tptm, err := tpr.lr.GetTPTimings(tpr.tpid, rp.TimingId)
if err != nil || len(tptm) == 0 {
return false, fmt.Errorf("no timing with id %s: %v", rp.TimingId, err)
return false, fmt.Errorf("no timing with id %s: %q", rp.TimingId, err)
}
tm, err = MapTPTimings(tptm)
if err != nil {
@@ -281,7 +281,7 @@ func (tpr *TpReader) LoadRatingPlansFiltered(tag string) (bool, error) {
rp.SetTiming(tm[rp.TimingId])
tpdrm, err := tpr.lr.GetTPDestinationRates(tpr.tpid, rp.DestinationRatesId, nil)
if err != nil || len(tpdrm) == 0 {
return false, fmt.Errorf("no DestinationRates profile with id %s: %v", rp.DestinationRatesId, err)
return false, fmt.Errorf("no DestinationRates profile with id %q: %v", rp.DestinationRatesId, err)
}
drm, err := MapTPDestinationRates(tpdrm)
if err != nil {
@@ -290,7 +290,7 @@ func (tpr *TpReader) LoadRatingPlansFiltered(tag string) (bool, error) {
for _, drate := range drm[rp.DestinationRatesId].DestinationRates {
tprt, err := tpr.lr.GetTPRates(tpr.tpid, drate.RateId)
if err != nil || len(tprt) == 0 {
return false, fmt.Errorf("no Rates profile with id %s: %v", drate.RateId, err)
return false, fmt.Errorf("no Rates profile with id %q: %v", drate.RateId, err)
}
rt, err := MapTPRates(tprt)
if err != nil {
@@ -320,7 +320,7 @@ func (tpr *TpReader) LoadRatingPlansFiltered(tag string) (bool, error) {
continue
}
if !destsExist {
return false, fmt.Errorf("could not get destination for tag %v", drate.DestinationId)
return false, fmt.Errorf("could not get destination for tag %q", drate.DestinationId)
}
for _, destination := range dms {
tpr.dm.SetDestination(destination, utils.NonTransactional)
@@ -345,12 +345,12 @@ func (tpr *TpReader) LoadRatingPlans() (err error) {
for _, rplBnd := range rplBnds {
t, exists := tpr.timings[rplBnd.TimingId]
if !exists {
return fmt.Errorf("could not get timing for tag %v", rplBnd.TimingId)
return fmt.Errorf("could not get timing for tag %q", rplBnd.TimingId)
}
rplBnd.SetTiming(t)
drs, exists := tpr.destinationRates[rplBnd.DestinationRatesId]
if !exists {
return fmt.Errorf("could not find destination rate for tag %v", rplBnd.DestinationRatesId)
return fmt.Errorf("could not find destination rate for tag %q", rplBnd.DestinationRatesId)
}
plan, exists := tpr.ratingPlans[tag]
if !exists {
@@ -390,7 +390,7 @@ func (tpr *TpReader) LoadRatingProfilesFiltered(qriedRpf *utils.TPRatingProfile)
}
}
if !exists {
return fmt.Errorf("could not load rating plans for tag: %v", tpRa.RatingPlanId)
return fmt.Errorf("could not load rating plans for tag: %q", tpRa.RatingPlanId)
}
resultRatingProfile.RatingPlanActivations = append(resultRatingProfile.RatingPlanActivations,
&RatingPlanActivation{
@@ -430,7 +430,7 @@ func (tpr *TpReader) LoadRatingProfiles() (err error) {
}
}
if !exists {
return fmt.Errorf("could not load rating plans for tag: %v", tpRa.RatingPlanId)
return fmt.Errorf("could not load rating plans for tag: %q", tpRa.RatingPlanId)
}
rpf.RatingPlanActivations = append(rpf.RatingPlanActivations,
&RatingPlanActivation{
@@ -568,7 +568,7 @@ func (tpr *TpReader) LoadActions() (err error) {
if !found {
if timing, err = tpr.dm.GetTiming(timingID, false,
utils.NonTransactional); err != nil {
return fmt.Errorf("error: <%s> querying timing with id: <%s>",
return fmt.Errorf("error: <%s> querying timing with id: <%q>",
err.Error(), timingID)
}
}
@@ -600,15 +600,15 @@ func (tpr *TpReader) LoadActionPlans() (err error) {
_, exists := tpr.actions[at.ActionsId]
if !exists && tpr.dm.dataDB != nil {
if exists, err = tpr.dm.HasData(utils.ACTION_PREFIX, at.ActionsId, ""); err != nil {
return fmt.Errorf("[ActionPlans] Error querying actions: %v - %s", at.ActionsId, err.Error())
return fmt.Errorf("[ActionPlans] Error querying actions: %q - %s", at.ActionsId, err.Error())
}
}
if !exists {
return fmt.Errorf("[ActionPlans] Could not load the action for tag: %v", at.ActionsId)
return fmt.Errorf("[ActionPlans] Could not load the action for tag: %q", at.ActionsId)
}
t, exists := tpr.timings[at.TimingId]
if !exists {
return fmt.Errorf("[ActionPlans] Could not load the timing for tag: %v", at.TimingId)
return fmt.Errorf("[ActionPlans] Could not load the timing for tag: %q", at.TimingId)
}
var actPln *ActionPlan
if actPln, exists = tpr.actionPlans[atId]; !exists {
@@ -758,7 +758,7 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions)
if err != nil {
return errors.New(err.Error() + " (ActionPlan): " + accountAction.ActionPlanId)
} else if len(tpap) == 0 {
return fmt.Errorf("no action plan with id <%s>", accountAction.ActionPlanId)
return fmt.Errorf("no action plan with id <%q>", accountAction.ActionPlanId)
}
aps := MapTPActionTimings(tpap)
var actionPlan *ActionPlan
@@ -769,7 +769,7 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions)
if actions, err := tpr.lr.GetTPActions(tpr.tpid, at.ActionsId); err != nil {
return errors.New(err.Error() + " (Actions): " + at.ActionsId)
} else if len(actions) == 0 {
return fmt.Errorf("no action with id <%s>", at.ActionsId)
return fmt.Errorf("no action with id <%q>", at.ActionsId)
}
var t *utils.TPTiming
if at.TimingId != utils.ASAP {
@@ -777,7 +777,7 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions)
if err != nil {
return errors.New(err.Error() + " (Timing): " + at.TimingId)
} else if len(tptm) == 0 {
return fmt.Errorf("no timing with id <%s>", at.TimingId)
return fmt.Errorf("no timing with id <%q>", at.TimingId)
}
tm, err := MapTPTimings(tptm)
if err != nil {
@@ -1039,7 +1039,7 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions)
EndTime: timing.EndTime,
})
} else {
return fmt.Errorf("could not find timing: %v", timingID)
return fmt.Errorf("could not find timing: %q", timingID)
}
}
}
@@ -1083,13 +1083,13 @@ func (tpr *TpReader) LoadAccountActions() (err error) {
for _, aa := range storAts {
aaKeyID := aa.KeyId()
if _, alreadyDefined := tpr.accountActions[aa.KeyId()]; alreadyDefined {
return fmt.Errorf("duplicate account action found: %s", aaKeyID)
return fmt.Errorf("duplicate account action found: %q", aaKeyID)
}
var aTriggers ActionTriggers
if aa.ActionTriggersId != "" {
var exists bool
if aTriggers, exists = tpr.actionsTriggers[aa.ActionTriggersId]; !exists {
return fmt.Errorf("could not get action triggers for tag %s", aa.ActionTriggersId)
return fmt.Errorf("could not get action triggers for tag %q", aa.ActionTriggersId)
}
}
ub := &Account{
@@ -1103,7 +1103,7 @@ func (tpr *TpReader) LoadAccountActions() (err error) {
if aa.ActionPlanId != "" {
actionPlan, exists := tpr.actionPlans[aa.ActionPlanId]
if !exists {
return fmt.Errorf("could not get action plan for tag %v", aa.ActionPlanId)
return fmt.Errorf("could not get action plan for tag %q", aa.ActionPlanId)
}
if actionPlan.AccountIDs == nil {
actionPlan.AccountIDs = make(utils.StringMap)