From ac934ca94370f5204319f88eef0a7747fe7e133a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 19 Apr 2020 13:47:34 +0200 Subject: 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 --- application/models/Muser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'application/models') 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( -- cgit v1.2.3-24-g4f1b