Livestatus\Connection: implement socketError method
This commit is contained in:
parent
be8120bd39
commit
d66c95a725
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue