summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2020-04-19 13:47:34 +0200
committerFlorian Pritz <bluewind@xinu.at>2020-04-19 13:55:45 +0200
commitac934ca94370f5204319f88eef0a7747fe7e133a (patch)
treeaadc36591663cb706f4b208491b3ceed5e6abc55 /application/models
parentddf6734dfeac65babf096a3147338f54d712b6e3 (diff)
Reclassify various exceptions as UserInputException
These are errors that a user can correct themselves so we should classify them accordingly. That way they get the correct HTTP status code and they also get ignored by the logging code. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models')
-rw-r--r--application/models/Muser.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/application/models/Muser.php b/application/models/Muser.php
index ef260f47b..521d1c989 100644
--- a/application/models/Muser.php
+++ b/application/models/Muser.php
@@ -162,15 +162,15 @@ class Muser extends CI_Model {
public function add_user($username, $password, $email, $referrer)
{
if (!$this->valid_username($username)) {
- throw new \exceptions\PublicApiException("user/invalid-username", "Invalid username (only up to 32 chars of a-z0-9 are allowed)");
+ throw new \exceptions\UserInputException("user/invalid-username", "Invalid username (only up to 32 chars of a-z0-9 are allowed)");
} else {
if ($this->muser->username_exists($username)) {
- throw new \exceptions\PublicApiException("user/username-already-exists", "Username already exists");
+ throw new \exceptions\UserInputException("user/username-already-exists", "Username already exists");
}
}
if (!$this->valid_email($email)) {
- throw new \exceptions\PublicApiException("user/invalid-email", "Invalid email");
+ throw new \exceptions\UserInputException("user/invalid-email", "Invalid email");
}
$this->db->set(array(