mcp: unexport incidentally exported error codes (#536)

Unexport error codes that were accidentally exported. I don't think it's
possible that they could be useful for users (see #535).

Fixes #535
This commit is contained in:
Robert Findley 2025-09-26 14:04:28 -04:00 • committed by GitHub
commit b2048cd73a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,7 +66,7 @@ func TestToolErrorHandling(t *testing.T) {
// Create a tool that returns a structured error
structuredErrorHandler := func(ctx context.Context, req *CallToolRequest, args map[string]any) (*CallToolResult, any, error) {
return nil, nil, &jsonrpc2.WireError{
Code: CodeInvalidParams,
Code: codeInvalidParams,
Message: "internal server error",
}
}
@ -111,8 +111,8 @@ func TestToolErrorHandling(t *testing.T) {
t.Fatalf("expected WireError, got %[1]T: %[1]v", err)
}
if wireErr.Code != CodeInvalidParams {
t.Errorf("expected error code %d, got %d", CodeInvalidParams, wireErr.Code)
if wireErr.Code != codeInvalidParams {
t.Errorf("expected error code %d, got %d", codeInvalidParams, wireErr.Code)
}
})