diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-03-09 19:45:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 19:45:52 +0100 |
commit | 16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4 (patch) | |
tree | d744155a1b68a203d4483195202d3d8562d02cf0 /application/config/exception | |
parent | 9c5daad19c850d852f2e78ca571ad199362c0ffe (diff) | |
parent | 5ba55f0cf287c583019bbb731ad98e04a14da972 (diff) | |
download | Shaarli-16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4.tar.gz Shaarli-16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4.tar.zst Shaarli-16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4.zip |
Merge pull request #794 from ArthurHoaro/hotfix/namespace
Move config exception to dedicated classes with proper namespace
Diffstat (limited to 'application/config/exception')
-rw-r--r-- | application/config/exception/MissingFieldConfigException.php | 23 | ||||
-rw-r--r-- | application/config/exception/UnauthorizedConfigException.php | 18 |
2 files changed, 41 insertions, 0 deletions
diff --git a/application/config/exception/MissingFieldConfigException.php b/application/config/exception/MissingFieldConfigException.php new file mode 100644 index 00000000..6346c6a9 --- /dev/null +++ b/application/config/exception/MissingFieldConfigException.php | |||
@@ -0,0 +1,23 @@ | |||
1 | <?php | ||
2 | |||
3 | |||
4 | namespace Shaarli\Config\Exception; | ||
5 | |||
6 | /** | ||
7 | * Exception used if a mandatory field is missing in given configuration. | ||
8 | */ | ||
9 | class 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 = 'Configuration value is required for '. $this->field; | ||
22 | } | ||
23 | } | ||
diff --git a/application/config/exception/UnauthorizedConfigException.php b/application/config/exception/UnauthorizedConfigException.php new file mode 100644 index 00000000..79672c1b --- /dev/null +++ b/application/config/exception/UnauthorizedConfigException.php | |||
@@ -0,0 +1,18 @@ | |||
1 | <?php | ||
2 | |||
3 | |||
4 | namespace Shaarli\Config\Exception; | ||
5 | |||
6 | /** | ||
7 | * Exception used if an unauthorized attempt to edit configuration has been made. | ||
8 | */ | ||
9 | class UnauthorizedConfigException extends \Exception | ||
10 | { | ||
11 | /** | ||
12 | * Construct exception. | ||
13 | */ | ||
14 | public function __construct() | ||
15 | { | ||
16 | $this->message = 'You are not authorized to alter config.'; | ||
17 | } | ||
18 | } | ||