From 7301480225ca902ca75f5684fe491db88b3e1b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 12 Mar 2024 23:08:49 +0000 Subject: [PATCH] better error message --- flow/connectors/kafka/kafka.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flow/connectors/kafka/kafka.go b/flow/connectors/kafka/kafka.go index ad94c76afe..e2c71b0fb1 100644 --- a/flow/connectors/kafka/kafka.go +++ b/flow/connectors/kafka/kafka.go @@ -173,9 +173,10 @@ func (c *KafkaConnector) SyncRecords(ctx context.Context, req *model.SyncRecords ls.SetTop(0) var ok bool - fn, ok = ls.Env.RawGetString("onRecord").(*lua.LFunction) + lfn := ls.Env.RawGetString("onRecord") + fn, ok = lfn.(*lua.LFunction) if !ok { - return nil, errors.New("script should define `onRecord` function") + return nil, fmt.Errorf("script should define `onRecord` as function, not %s", lfn.Type()) } } else { return nil, errors.New("kafka mirror must have script")