Livestatus\Connection: throw "better" exceptions

Removed outdated method
This commit is contained in:
Thomas Gelf 2014-11-16 15:51:26 +01:00
parent 578873f695
commit d6b9f56a2c
1 changed files with 5 additions and 10 deletions

View File

@ -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;