From d6b9f56a2c9c650a75d4128746714ecf011e9f1b Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 16 Nov 2014 15:51:26 +0100 Subject: [PATCH] Livestatus\Connection: throw "better" exceptions Removed outdated method --- library/Icinga/Protocol/Livestatus/Connection.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/library/Icinga/Protocol/Livestatus/Connection.php b/library/Icinga/Protocol/Livestatus/Connection.php index 314af9f4a..7b8f438f5 100644 --- a/library/Icinga/Protocol/Livestatus/Connection.php +++ b/library/Icinga/Protocol/Livestatus/Connection.php @@ -5,7 +5,8 @@ namespace Icinga\Protocol\Livestatus; use Icinga\Application\Benchmark; -use Exception; +use Icinga\Exception\ConfigurationError; +use Icinga\Exception\SystemPermissionException; use Icinga\Exception\IcingaException; /** @@ -74,7 +75,7 @@ class Connection $this->assertPhpExtensionLoaded('sockets'); if ($socket[0] === '/') { if (! is_writable($socket)) { - throw new IcingaException( + throw new SystemPermissionException( 'Cannot write to livestatus socket "%s"', $socket ); @@ -83,24 +84,18 @@ class Connection $this->socket_path = $socket; } else { if (! preg_match('~^tcp://([^:]+):(\d+)~', $socket, $m)) { - throw new IcingaException( + throw new ConfigurationError( 'Invalid TCP socket syntax: "%s"', $socket ); } - // TODO: Better syntax checks + // TODO: Better config syntax checks $this->socket_host = $m[1]; $this->socket_port = (int) $m[2]; $this->socket_type = self::TYPE_TCP; } } - public function select() - { - $select = new Query($this); - return $select; - } - public function count(Query $query) { return 100;