From a2011b16655280ef648028d26f3137edb45f5f58 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 26 Aug 2014 11:21:57 +0200 Subject: [PATCH] SystemPermissionException: extend IcingaException refs #6931 --- library/Icinga/Application/Modules/Manager.php | 16 ++++++++++------ .../Exception/SystemPermissionException.php | 4 +--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/library/Icinga/Application/Modules/Manager.php b/library/Icinga/Application/Modules/Manager.php index 9022d4907..60c2ee85b 100644 --- a/library/Icinga/Application/Modules/Manager.php +++ b/library/Icinga/Application/Modules/Manager.php @@ -219,8 +219,8 @@ class Manager if (!is_writable($this->enableDir)) { throw new SystemPermissionException( - 'Can not enable module "' . $name . '". ' - . 'Insufficient system permissions for enabling modules.' + 'Can not enable module "%s". Insufficient system permissions for enabling modules.', + $name ); } @@ -232,9 +232,11 @@ class Manager $error = error_get_last(); if (strstr($error["message"], "File exists") === false) { throw new SystemPermissionException( - 'Could not enable module "' . $name . '" due to file system errors. ' + 'Could not enable module "%s" due to file system errors. ' . 'Please check path and mounting points because this is not a permission error. ' - . 'Primary error was: ' . $error['message'] + . 'Primary error was: %s', + $name, + $error['message'] ); } } @@ -287,9 +289,11 @@ class Manager if (!@unlink($link)) { $error = error_get_last(); throw new SystemPermissionException( - 'Could not disable module "' . $name . '" due to file system errors. ' + 'Could not disable module "%s" due to file system errors. ' . 'Please check path and mounting points because this is not a permission error. ' - . 'Primary error was: ' . $error['message'] + . 'Primary error was: %s', + $name, + $error['message'] ); } } diff --git a/library/Icinga/Exception/SystemPermissionException.php b/library/Icinga/Exception/SystemPermissionException.php index 8202e34ac..33dfe596c 100644 --- a/library/Icinga/Exception/SystemPermissionException.php +++ b/library/Icinga/Exception/SystemPermissionException.php @@ -4,11 +4,9 @@ namespace Icinga\Exception; -use \Exception; - /** * Handle problems according to file system permissions */ -class SystemPermissionException extends Exception +class SystemPermissionException extends IcingaException { }