diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index e81e8062f..f794d46a0 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -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 + ); } } diff --git a/library/Icinga/Application/Modules/Manager.php b/library/Icinga/Application/Modules/Manager.php index 366f77c30..4154d2c20 100644 --- a/library/Icinga/Application/Modules/Manager.php +++ b/library/Icinga/Application/Modules/Manager.php @@ -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) { diff --git a/library/Icinga/Exception/NotReadableError.php b/library/Icinga/Exception/NotReadableError.php index 6bc4fc55f..41a7ec8fd 100644 --- a/library/Icinga/Exception/NotReadableError.php +++ b/library/Icinga/Exception/NotReadableError.php @@ -4,8 +4,6 @@ namespace Icinga\Exception; -use RuntimeException; - -class NotReadableError extends RuntimeException +class NotReadableError extends IcingaException { } diff --git a/library/Icinga/User/Preferences/Store/DbStore.php b/library/Icinga/User/Preferences/Store/DbStore.php index 728637a35..c0818f303 100644 --- a/library/Icinga/User/Preferences/Store/DbStore.php +++ b/library/Icinga/User/Preferences/Store/DbStore.php @@ -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 ); } diff --git a/library/Icinga/User/Preferences/Store/IniStore.php b/library/Icinga/User/Preferences/Store/IniStore.php index eb1c4cbfb..93b31b82b 100644 --- a/library/Icinga/User/Preferences/Store/IniStore.php +++ b/library/Icinga/User/Preferences/Store/IniStore.php @@ -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);