guard on remove rating profile api

This commit is contained in:
Radu Ioan Fericean
2015-08-19 12:25:51 +03:00
parent 7d20097754
commit 59b73621d5

View File

@@ -1169,7 +1169,13 @@ func (self *ApierV1) RemoveRatingProfile(attr AttrRemoveRatingProfile, reply *st
if attr.Tennat != "" && attr.Direction == "" {
return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "Direction")
}
err := self.RatingDb.RemoveRatingProfile(attr.GetId())
_, err := engine.Guardian.Guard(func() (interface{}, error) {
err := self.RatingDb.RemoveRatingProfile(attr.GetId())
if err != nil {
return 0, err
}
return 0, nil
}, "RemoveRatingProfile")
if err != nil {
*reply = err.Error()
return err