Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (c *client) Call(
}
procedure := spec.ProcedureForPath(procedurePath)
if procedure == nil {
return fmt.Errorf("no procedure for path %q", procedurePath)
return NewErrorf(CodeUnimplemented, "procedure unimplemented: %q", procedurePath)
}
data, err := marshalRequest(c.format, request)
if err != nil {
Expand Down
19 changes: 19 additions & 0 deletions pluginrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,25 @@ func TestEchoError(t *testing.T) {
)
}

func TestUnimplemented(t *testing.T) {
t.Parallel()
forEachDimension(
t,
func(t *testing.T, client pluginrpc.Client) {
err := client.Call(
context.Background(),
"/foo/bar",
nil,
nil,
)
pluginrpcError := &pluginrpc.Error{}
require.Error(t, err)
require.ErrorAs(t, err, &pluginrpcError)
require.Equal(t, pluginrpc.CodeUnimplemented, pluginrpcError.Code())
},
)
}

func forEachDimension(t *testing.T, f func(*testing.T, pluginrpc.Client)) {
for _, format := range allTestFormats {
for j, newClient := range []func(...pluginrpc.ClientOption) (pluginrpc.Client, error){newExecRunnerClient, newServerRunnerClient} {
Expand Down
Loading