NotReadableError: extend IcingaException

refs #6931
This commit is contained in:
Alexander Klimov 2014-08-25 12:38:34 +02:00
parent f4dbb4df96
commit 6c9947326d
5 changed files with 15 additions and 9 deletions

View File

@ -61,7 +61,10 @@ class Config extends Zend_Config
$this->configFile = $filepath;
$this->merge(new Zend_Config_Ini($filepath));
} else {
throw new NotReadableError('Cannot read config file "' . $filename . '". Permission denied');
throw new NotReadableError(
'Cannot read config file "%s". Permission denied',
$filename
);
}
}

View File

@ -110,12 +110,14 @@ class Manager
}
if (!is_dir($this->enableDir)) {
throw new NotReadableError(
'Cannot read enabled modules. Module directory "' . $this->enableDir . '" is not a directory'
'Cannot read enabled modules. Module directory "%s" is not a directory',
$this->enableDir
);
}
if (!is_readable($this->enableDir)) {
throw new NotReadableError(
'Cannot read enabled modules. Module directory "' . $this->enableDir . '" is not readable'
'Cannot read enabled modules. Module directory "%s" is not readable',
$this->enableDir
);
}
if (($dh = opendir($canonical)) !== false) {

View File

@ -4,8 +4,6 @@
namespace Icinga\Exception;
use RuntimeException;
class NotReadableError extends RuntimeException
class NotReadableError extends IcingaException
{
}

View File

@ -78,7 +78,9 @@ class DbStore extends PreferencesStore
->fetchAll();
} catch (Exception $e) {
throw new NotReadableError(
'Cannot fetch preferences for user ' . $this->getUser()->getUsername() . ' from database', 0, $e
'Cannot fetch preferences for user %s from database',
$this->getUser()->getUsername(),
$e
);
}

View File

@ -62,8 +62,9 @@ class IniStore extends PreferencesStore
if (file_exists($this->preferencesFile)) {
if (!is_readable($this->preferencesFile)) {
throw new NotReadableError(
'Preferences INI file ' . $this->preferencesFile . ' for user '
. $this->getUser()->getUsername() . ' is not readable'
'Preferences INI file %s for user %s is not readable',
$this->preferencesFile,
$this->getUser()->getUsername()
);
} else {
$this->preferences = parse_ini_file($this->preferencesFile);