aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/config/exception
diff options
context:
space:
mode:
Diffstat (limited to 'application/config/exception')
-rw-r--r--application/config/exception/MissingFieldConfigException.php23
-rw-r--r--application/config/exception/PluginConfigOrderException.php17
-rw-r--r--application/config/exception/UnauthorizedConfigException.php18
3 files changed, 58 insertions, 0 deletions
diff --git a/application/config/exception/MissingFieldConfigException.php b/application/config/exception/MissingFieldConfigException.php
new file mode 100644
index 00000000..9e0a9359
--- /dev/null
+++ b/application/config/exception/MissingFieldConfigException.php
@@ -0,0 +1,23 @@
1<?php
2
3
4namespace Shaarli\Config\Exception;
5
6/**
7 * Exception used if a mandatory field is missing in given configuration.
8 */
9class MissingFieldConfigException extends \Exception
10{
11 public $field;
12
13 /**
14 * Construct exception.
15 *
16 * @param string $field field name missing.
17 */
18 public function __construct($field)
19 {
20 $this->field = $field;
21 $this->message = sprintf(t('Configuration value is required for %s'), $this->field);
22 }
23}
diff --git a/application/config/exception/PluginConfigOrderException.php b/application/config/exception/PluginConfigOrderException.php
new file mode 100644
index 00000000..f82ec26e
--- /dev/null
+++ b/application/config/exception/PluginConfigOrderException.php
@@ -0,0 +1,17 @@
1<?php
2
3namespace Shaarli\Config\Exception;
4
5/**
6 * Exception used if an error occur while saving plugin configuration.
7 */
8class PluginConfigOrderException extends \Exception
9{
10 /**
11 * Construct exception.
12 */
13 public function __construct()
14 {
15 $this->message = t('An error occurred while trying to save plugins loading order.');
16 }
17}
diff --git a/application/config/exception/UnauthorizedConfigException.php b/application/config/exception/UnauthorizedConfigException.php
new file mode 100644
index 00000000..72311fae
--- /dev/null
+++ b/application/config/exception/UnauthorizedConfigException.php
@@ -0,0 +1,18 @@
1<?php
2
3
4namespace Shaarli\Config\Exception;
5
6/**
7 * Exception used if an unauthorized attempt to edit configuration has been made.
8 */
9class UnauthorizedConfigException extends \Exception
10{
11 /**
12 * Construct exception.
13 */
14 public function __construct()
15 {
16 $this->message = t('You are not authorized to alter config.');
17 }
18}