Livestatus\Connection: implement socketError method

This commit is contained in:
Thomas Gelf 2014-11-16 15:54:32 +01:00
parent be8120bd39
commit d66c95a725
1 changed files with 14 additions and 0 deletions

View File

@ -257,6 +257,20 @@ class Connection
return true;
}
/**
* Raise an exception showing given message string and last socket error
*
* TODO: Find a better exception type for such errors
*
* @throws IcingaException
*/
protected function socketError($msg)
{
throw new IcingaException(
$msg . ': ' . socket_strerror(socket_last_error($this->connection))
);
}
protected function assertPhpExtensionLoaded($name)
{
if (! extension_loaded($name)) {