Skip to content

fix: throw client InvalidArgumentException for invalid PD endpoints (#814) - #1049

Open
kushkrg wants to merge 1 commit into
crazy-goat:masterfrom
kushkrg:fix/issue-814-invalid-endpoint-exception
Open

kushkrg wants to merge 1 commit into
crazy-goat:masterfrom
kushkrg:fix/issue-814-invalid-endpoint-exception

Conversation

@kushkrg

@kushkrg kushkrg commented Nov 12, 2026

Copy link
Copy Markdown

Summary

RawKvClient::create(['']) (and any other entry point that builds a connection through ConnectionFactory) threw the global \InvalidArgumentException for an empty PD endpoint, instead of the client exception type the documentation promises (Tikv\Client\Exception\InvalidArgumentException).

ConnectionFactory now validates every endpoint up front: each endpoint must be a non-empty string, otherwise the client InvalidArgumentException is thrown with the index of the offending endpoint.

Changes

  • src/Client/Connection/ConnectionFactory.php: validate endpoints before creating the connection.
  • tests/Unit/Connection/ConnectionFactoryTest.php: three new tests covering an empty-string endpoint, a non-string endpoint, and a valid endpoint list.
  • CHANGELOG.md: entry under Unreleased > Fixed.

Full unit suite passes locally: 132 tests, 282 assertions.

Closes #814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RawKvClient::create(['']) throws the global InvalidArgumentException, not the documented client exception

1 participant