diff --git a/dataconv/share.go b/dataconv/share.go index c8726131..2070b54d 100644 --- a/dataconv/share.go +++ b/dataconv/share.go @@ -272,6 +272,6 @@ func shardDictPerform(thread *starlark.Thread, b *starlark.Builtin, args starlar case starlark.Callable: return pr.CallInternal(thread, starlark.Tuple{d}, nil) default: - return nil, fmt.Errorf("unsupported callable type: %s", pr.Type()) + return nil, fmt.Errorf("%s: not callable type: %s", b.Name(), pr.Type()) } } diff --git a/dataconv/share_test.go b/dataconv/share_test.go index e807e5cf..3bf528a0 100644 --- a/dataconv/share_test.go +++ b/dataconv/share_test.go @@ -204,6 +204,14 @@ func TestSharedDict_Functions(t *testing.T) { assert.eq(sd.len(), 1) `), }, + { + name: `attr: custom len -- invalid args`, + script: itn.HereDoc(` + load('share', 'sd') + sd.len(123) + `), + wantErr: `len: got 1 arguments, want 0`, + }, { name: `attr: custom perform`, script: itn.HereDoc(` @@ -215,6 +223,22 @@ func TestSharedDict_Functions(t *testing.T) { print(sd) `), }, + { + name: `attr: custom perform -- invalid args`, + script: itn.HereDoc(` + load('share', 'sd') + sd.perform() + `), + wantErr: `perform: missing argument for fn`, + }, + { + name: `attr: custom perform -- invalid type`, + script: itn.HereDoc(` + load('share', 'sd') + sd.perform(123) + `), + wantErr: `perform: not callable type: int`, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {