From 29ac72d52d615cfe294352c4252d274afb2a24b0 Mon Sep 17 00:00:00 2001 From: adragusin Date: Fri, 13 Mar 2020 12:12:22 +0200 Subject: [PATCH] Improved error MandatoryIeMissing --- apier/v1/attributes_it_test.go | 2 +- engine/attributes.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apier/v1/attributes_it_test.go b/apier/v1/attributes_it_test.go index 92d1ba302..037e94a54 100644 --- a/apier/v1/attributes_it_test.go +++ b/apier/v1/attributes_it_test.go @@ -413,7 +413,7 @@ func testAttributeSProcessEventMissing(t *testing.T) { var rplyEv engine.AttrSProcessEventReply if err := attrSRPC.Call(utils.AttributeSv1ProcessEvent, ev, &rplyEv); err == nil || - err.Error() != utils.ErrMandatoryIeMissing.Error() { + err.Error() != "MANDATORY_IE_MISSING: [Category]" { t.Error(err) } } diff --git a/engine/attributes.go b/engine/attributes.go index 393deb7ed..5b6fd7f4c 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -346,17 +346,17 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent, } // Make sure the requested fields were populated if err == utils.ErrNotFound { - for _, valIface := range args.CGREvent.Event { + for val, valIface := range args.CGREvent.Event { if valIface == interface{}(utils.MetaAttributes) { - err = utils.ErrMandatoryIeMissing + err = utils.NewErrMandatoryIeMissing(val) break } } } else if err == nil { - for _, valIface := range apiRply.CGREvent.Event { + for val, valIface := range apiRply.CGREvent.Event { if valIface == interface{}(utils.MetaAttributes) { // mandatory IE missing - err = utils.ErrMandatoryIeMissing + err = utils.NewErrMandatoryIeMissing(val) break } }