refactored WaitForHealthCheck strategy and added more granular exceptions

This commit is contained in:
Sergei Shitikov
2024-09-29 14:46:54 +02:00
parent 2f1c8750e0
commit a58ff460fa
8 changed files with 131 additions and 39 deletions
@@ -4,19 +4,11 @@ declare(strict_types=1);
namespace Testcontainers\Exception;
class ContainerWaitingTimeoutException extends \RuntimeException
class ContainerWaitingTimeoutException extends ContainerNotReadyException
{
protected string $containerId;
public function __construct(string $containerId, ?string $message = null, ?\Throwable $previous = null)
{
$this->containerId = $containerId;
$message ??= sprintf('Timeout reached while waiting for container %s', $containerId);
parent::__construct($message, 0, $previous);
parent::__construct($message, $containerId, $previous);
}
public function getContainerId(): string
{
return $this->containerId;
}
}
}