[Client] Reject non-positive timeouts in Configuration (#415)
* [Client] Reject non-positive timeouts in Configuration * [Client] Drop redundant comments on timeout validation
This commit is contained in:
parent
785fc3b9b7
commit
d9b3c0ba4e
1 changed files with 100 additions and 0 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
namespace Mcp\Client;
|
||||
|
||||
use Mcp\Exception\InvalidArgumentException;
|
||||
use Mcp\Schema\ClientCapabilities;
|
||||
use Mcp\Schema\Enum\ProtocolVersion;
|
||||
use Mcp\Schema\Implementation;
|
||||
|
|
@ -30,5 +31,12 @@ class Configuration
|
|||
public readonly int $requestTimeout = 120,
|
||||
public readonly int $maxRetries = 3,
|
||||
) {
|
||||
if ($initTimeout < 1) {
|
||||
throw new InvalidArgumentException(\sprintf('The initialization timeout must be a positive number of seconds, got %d.', $initTimeout));
|
||||
}
|
||||
|
||||
if ($requestTimeout < 1) {
|
||||
throw new InvalidArgumentException(\sprintf('The request timeout must be a positive number of seconds, got %d.', $requestTimeout));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue