refined error messages

This commit is contained in:
Radu Ioan Fericean
2016-01-18 17:22:18 +02:00
parent f097ac8646
commit e0c8ea02c5
4 changed files with 10 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ import "github.com/cgrates/cgrates/apier/v1"
func init() {
c := &CmdGetScheduledActions{
name: "scheduler_queue",
name: "2",
rpcMethod: "ApierV1.GetScheduledActions",
rpcParams: &v1.AttrsGetScheduledActions{},
}

View File

@@ -605,7 +605,8 @@ func removeBalanceAction(ub *Account, sq *StatsQueueTriggered, a *Action, acs Ac
func transferMonetaryDefault(acc *Account, sq *StatsQueueTriggered, a *Action, acs Actions) error {
if acc == nil {
return utils.NewErrAccountNotFound("", "*transfer_monetary_default")
utils.Logger.Err("*transfer_monetary_default called without account")
return utils.ErrAccountNotFound
}
if _, exists := acc.BalanceMap[utils.MONETARY]; !exists {
return utils.ErrNotFound

View File

@@ -195,7 +195,11 @@ func (cd *CallDescriptor) LoadRatingPlans() (err error) {
err, _ = cd.getRatingPlansForPrefix(cd.GetKey(FALLBACK_SUBJECT), 1)
}
//load the rating plans
if err != nil || !cd.continousRatingInfos() {
if err != nil {
utils.Logger.Err(fmt.Sprintf("Rating plan not found for destination %s and account: %s, subject: %s", cd.Destination, cd.GetAccountKey(), cd.GetKey(cd.Subject)))
err = utils.ErrRatingPlanNotFound
}
if !cd.continousRatingInfos() {
utils.Logger.Err(fmt.Sprintf("Destination %s not authorized for account: %s, subject: %s", cd.Destination, cd.GetAccountKey(), cd.GetKey(cd.Subject)))
err = utils.ErrUnauthorizedDestination
}

View File

@@ -13,10 +13,6 @@ func NewErrServerError(err error) error {
return fmt.Errorf("SERVER_ERROR: %s", err)
}
func NewErrAccountNotFound(accID, context string) error {
return fmt.Errorf("ACCOUNT_NOT_FOUND: %s in %s", accID, context)
}
var (
ErrNotImplemented = errors.New("NOT_IMPLEMENTED")
ErrNotFound = errors.New("NOT_FOUND")
@@ -30,7 +26,8 @@ var (
ErrInvalidPath = errors.New("INVALID_PATH")
ErrInvalidKey = errors.New("INVALID_KEY")
ErrUnauthorizedDestination = errors.New("UNAUTHORIZED_DESTINATION")
ErrAccountNotFound = errors.New("AccountNotFound")
ErrRatingPlanNotFound = errors.New("RATING_PLAN_NOT_FOUND")
ErrAccountNotFound = errors.New("ACCOUNT_NOT_FOUND")
)
const (