Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Mar 12, 2024
1 parent dae2af6 commit 7301480
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flow/connectors/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7301480

Please sign in to comment.