diff options
author | Florian Pritz <bluewind@xinu.at> | 2020-04-19 13:47:34 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2020-04-19 13:55:45 +0200 |
commit | ac934ca94370f5204319f88eef0a7747fe7e133a (patch) | |
tree | aadc36591663cb706f4b208491b3ceed5e6abc55 /application/controllers/User.php | |
parent | ddf6734dfeac65babf096a3147338f54d712b6e3 (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/controllers/User.php')
-rw-r--r-- | application/controllers/User.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/application/controllers/User.php b/application/controllers/User.php index c98784d50..00d348240 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -326,7 +326,7 @@ class User extends MY_Controller { $username = $this->input->post("username"); if (!$this->muser->username_exists($username)) { - throw new \exceptions\PublicApiException("user/reset_password/invalid-username", "Invalid username"); + throw new \exceptions\UserInputException("user/reset_password/invalid-username", "Invalid username"); } $userinfo = $this->db->select('id, email, username') @@ -485,18 +485,18 @@ class User extends MY_Controller { $values = explode("-", $value); if (!is_array($values) || count($values) != 2) { - throw new \exceptions\PublicApiException("user/profile/invalid-upload-id-limit", "Invalid upload id limit value"); + throw new \exceptions\UserInputException("user/profile/invalid-upload-id-limit", "Invalid upload id limit value"); } $lower = intval($values[0]); $upper = intval($values[1]); if ($lower > $upper) { - throw new \exceptions\PublicApiException("user/profile/lower-bigger-than-upper", "lower limit > upper limit"); + throw new \exceptions\UserInputException("user/profile/lower-bigger-than-upper", "lower limit > upper limit"); } if ($lower < 3 || $upper > 64) { - throw new \exceptions\PublicApiException("user/profile/limit-out-of-bounds", "upper or lower limit out of bounds (3-64)"); + throw new \exceptions\UserInputException("user/profile/limit-out-of-bounds", "upper or lower limit out of bounds (3-64)"); } return $lower."-".$upper; @@ -512,7 +512,7 @@ class User extends MY_Controller { } if (!$this->muser->valid_email($value)) { - throw new \exceptions\PublicApiException("user/profile/invalid-email", "Invalid email"); + throw new \exceptions\UserInputException("user/profile/invalid-email", "Invalid email"); } $this->load->library("email"); |