diff options
author | uckelman <uckelman@nomic.net> | 2010-04-11 19:03:19 +0000 |
---|---|---|
committer | uckelman <uckelman@nomic.net> | 2010-04-11 19:03:19 +0000 |
commit | 001f9be89da75fd15aec093857458a270499e681 (patch) | |
tree | 23c78cb1402d8d3dd12c895d318c795fbe01e6dd /src/PhpBB3.php | |
parent | a9880643f1adebb81112835d665fb8b5b6904491 (diff) |
Converted trigger_error to 'throw new Exception'.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6669 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src/PhpBB3.php')
-rw-r--r-- | src/PhpBB3.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/PhpBB3.php b/src/PhpBB3.php index 22234f5..37c4bdf 100644 --- a/src/PhpBB3.php +++ b/src/PhpBB3.php @@ -28,11 +28,11 @@ class PhpBB3 { $ids = array($id); $err = user_get_id_name($ids, $names); if ($err) { - trigger_error("Could not resolve user id $id: $err", E_USER_ERROR); + throw new Exception("Could not resolve user id $id: $err"); } if (!array_key_exists($id, $names)) { - trigger_error("Unknown user id: $id", E_USER_ERROR); + throw new Exception("Unknown user id: $id"); } return $names[$id]; @@ -68,8 +68,7 @@ class PhpBB3 { default: # Should be impossible due to LIMIT 1. - trigger_error("Too many rows returned: $sql", E_USER_ERROR); - break; + throw new Exception("Too many rows returned: $sql"); } } @@ -93,26 +92,25 @@ class PhpBB3 { default: # Should be impossible due to LIMIT 1. - trigger_error("Too many rows returned: $sql", E_USER_ERROR); - break; + throw new Exception("Too many rows returned: $sql"); } } public function postMessage($postType, $forumId, $topicId, $msg) { if ($postType != 'post' && $postType != 'reply') { - trigger_error('bad post type: ' . $postType, E_USER_ERROR); + throw new Exception('bad post type: ' . $postType); } if (!$this->forumExists($forumId)) { - trigger_error('forum does not exist: ' . $forumId, E_USER_ERROR); + throw new Exception('forum does not exist: ' . $forumId); } if ($postType == 'reply' && !$this->topicExists($topicId)) { - trigger_error('topic does not exist: ' . $topicId, E_USER_ERROR); + throw new Exception('topic does not exist: ' . $topicId); } if ($msg === null) { - trigger_error('message is null', E_USER_ERROR); + throw new Exception('message is null'); } $subject = $msg->getSubject(); @@ -187,15 +185,13 @@ class PhpBB3 { switch (count($rows)) { case 0: - trigger_error("No rows returned: $sql", E_USER_ERROR); - break; + throw new Exception("No rows returned: $sql"); case 1: return $rows[0]; default: - trigger_error("Too many rows returned: $sql", E_USER_ERROR); - break; + throw new Exception("Too many rows returned: $sql"); } } } |