From 3f95843c5b896eaeb737487446285d62ba31745d Mon Sep 17 00:00:00 2001 From: Pratham Shah Date: Thu, 26 Aug 2021 21:26:43 +0530 Subject: [PATCH] Error Response when no matching functions Send response to indicate no matching functions are found for the topic Signed-off-by: Pratham Shah --- types/invoker.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/invoker.go b/types/invoker.go index f0efaac..1f2a4a2 100644 --- a/types/invoker.go +++ b/types/invoker.go @@ -63,6 +63,13 @@ func (i *Invoker) InvokeWithContext(ctx context.Context, topicMap *TopicMap, top } matchedFunctions := topicMap.Match(topic) + if len(matchedFunctions) == 0 { + i.Responses <- InvokerResponse{ + Context: ctx, + Error: fmt.Errorf("no functions to invoke"), + } + } + for _, matchedFunction := range matchedFunctions { log.Printf("Invoke function: %s", matchedFunction)