From b63bb0ae403028279a0bdaf1a71cde57ec416cda Mon Sep 17 00:00:00 2001 From: parth-dadhaniya Date: Fri, 15 Mar 2024 15:21:15 +0530 Subject: [PATCH] Enhanced the code. --- pkg/ottl/expression.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/ottl/expression.go b/pkg/ottl/expression.go index e73e82d34937..f2013722eb2e 100644 --- a/pkg/ottl/expression.go +++ b/pkg/ottl/expression.go @@ -372,10 +372,7 @@ func (g StandardPMapGetter[K]) Get(ctx context.Context, tCtx K) (pcommon.Map, er case string: var jsonData pcommon.Map errUnmarshal := json.Unmarshal([]byte(val.(string)), &jsonData) - if errUnmarshal != nil { - return pcommon.Map{}, errUnmarshal - } - return jsonData, nil + return jsonData, errUnmarshal default: return pcommon.Map{}, TypeError(fmt.Sprintf("expected pcommon.Map but got %T", val)) }