NotWritableError: extend IcingaException

refs #6931
This commit is contained in:
Alexander Klimov 2014-08-25 12:56:35 +02:00
parent 6c9947326d
commit 7074fa1331
3 changed files with 15 additions and 12 deletions

View File

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

View File

@ -147,7 +147,9 @@ class DbStore extends PreferencesStore
} }
} catch (Exception $e) { } catch (Exception $e) {
throw new NotWritableError( throw new NotWritableError(
'Cannot insert preferences for user ' . $this->getUser()->getUsername() . ' into database', 0, $e 'Cannot insert preferences for user %s into database',
$this->getUser()->getUsername(),
$e
); );
} }
} }
@ -176,7 +178,9 @@ class DbStore extends PreferencesStore
} }
} catch (Exception $e) { } catch (Exception $e) {
throw new NotWritableError( throw new NotWritableError(
'Cannot update preferences for user ' . $this->getUser()->getUsername() . ' in database', 0, $e 'Cannot update preferences for user %s in database',
$this->getUser()->getUsername(),
$e
); );
} }
} }
@ -202,7 +206,9 @@ class DbStore extends PreferencesStore
); );
} catch (Exception $e) { } catch (Exception $e) {
throw new NotWritableError( throw new NotWritableError(
'Cannot delete preferences for user ' . $this->getUser()->getUsername() . ' from database', 0, $e 'Cannot delete preferences for user %s from database',
$this->getUser()->getUsername(),
$e
); );
} }
} }

View File

@ -98,10 +98,8 @@ class IniStore extends PreferencesStore
if (!file_exists($this->preferencesFile)) { if (!file_exists($this->preferencesFile)) {
if (!is_writable($this->getStoreConfig()->location)) { if (!is_writable($this->getStoreConfig()->location)) {
throw new NotWritableError( throw new NotWritableError(
sprintf( 'Path to the preferences INI files %s is not writable',
'Path to the preferences INI files %s is not writable', $this->getStoreConfig()->location
$this->getStoreConfig()->location
)
); );
} }
@ -110,8 +108,9 @@ class IniStore extends PreferencesStore
if (!is_writable($this->preferencesFile)) { if (!is_writable($this->preferencesFile)) {
throw new NotWritableError( throw new NotWritableError(
'Preferences INI file ' . $this->preferencesFile . ' for user ' 'Preferences INI file %s for user %s is not writable',
. $this->getUser()->getUsername() . ' is not writable' $this->preferencesFile,
$this->getUser()->getUsername()
); );
} }