diff options
| author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-07-23 20:28:04 -0500 |
|---|---|---|
| committer | Unknown Bliss <m@michaelcullum.com> | 2012-09-01 15:05:36 +0100 |
| commit | 2a7e1292919ed1397a3f1951e510d84565d002d7 (patch) | |
| tree | 7b559e2311aef386738660dc7b3be640b3fde6aa /phpBB/includes/extension/metadata_manager.php | |
| parent | 89f4cf6a8c10f9b0875cf7f278016aff67eb38fc (diff) | |
| download | forums-2a7e1292919ed1397a3f1951e510d84565d002d7.tar forums-2a7e1292919ed1397a3f1951e510d84565d002d7.tar.gz forums-2a7e1292919ed1397a3f1951e510d84565d002d7.tar.bz2 forums-2a7e1292919ed1397a3f1951e510d84565d002d7.tar.xz forums-2a7e1292919ed1397a3f1951e510d84565d002d7.zip | |
[ticket/10631] Simplify exceptions
PHPBB-10631
Diffstat (limited to 'phpBB/includes/extension/metadata_manager.php')
| -rw-r--r-- | phpBB/includes/extension/metadata_manager.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/phpBB/includes/extension/metadata_manager.php b/phpBB/includes/extension/metadata_manager.php index 126331ce1c..27b04d4c08 100644 --- a/phpBB/includes/extension/metadata_manager.php +++ b/phpBB/includes/extension/metadata_manager.php @@ -114,7 +114,7 @@ class phpbb_extension_metadata_manager if (!file_exists($this->metadata_file)) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::FILE_DOES_NOT_EXIST, $this->metadata_file); + throw new phpbb_extension_exception('The required file does not exist: ' . $this->metadata_file); } } @@ -127,18 +127,18 @@ class phpbb_extension_metadata_manager { if (!file_exists($this->metadata_file)) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::FILE_DOES_NOT_EXIST, $this->metadata_file); + throw new phpbb_extension_exception('The required file does not exist: ' . $this->metadata_file); } else { if (!($file_contents = file_get_contents($this->metadata_file))) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::FILE_GET_CONTENTS, $this->metadata_file); + throw new phpbb_extension_exception('file_get_contents failed on ' . $this->metadata_file); } if (($metadata = json_decode($file_contents, true)) === NULL) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::JSON_DECODE, $this->metadata_file); + throw new phpbb_extension_exception('json_decode failed on ' . $this->metadata_file); } $this->metadata = $metadata; @@ -182,12 +182,12 @@ class phpbb_extension_metadata_manager { if (!isset($this->metadata[$name])) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::NOT_SET, $name); + throw new phpbb_extension_exception("Required meta field '$name' has not been set."); } if (!preg_match($fields[$name], $this->metadata[$name])) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::INVALID, $name); + throw new phpbb_extension_exception("Meta field '$name' is invalid."); } } @@ -222,14 +222,14 @@ class phpbb_extension_metadata_manager { if (empty($this->metadata['authors'])) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::NOT_SET, 'authors'); + throw new phpbb_extension_exception("Required meta field 'authors' has not been set."); } foreach ($this->metadata['authors'] as $author) { if (!isset($author['name'])) { - throw new phpbb_exception_metadata(phpbb_exception_metadata::NOT_SET, 'author name'); + throw new phpbb_extension_exception("Required meta field 'author name' has not been set."); } } |
