summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/Api.php12
-rw-r--r--application/controllers/User.php10
-rw-r--r--application/controllers/api/v2/file.php2
3 files changed, 12 insertions, 12 deletions
diff --git a/application/controllers/Api.php b/application/controllers/Api.php
index 1fa49cb46..4f32ad427 100644
--- a/application/controllers/Api.php
+++ b/application/controllers/Api.php
@@ -24,7 +24,7 @@ class Api extends MY_Controller {
$function = $this->uri->segment(4);
if (!preg_match("/^v([0-9]+)(.[0-9]+){0,2}$/", $requested_version)) {
- throw new \exceptions\PublicApiException("api/invalid-version", "Invalid API version requested");
+ throw new \exceptions\UserInputException("api/invalid-version", "Invalid API version requested");
}
$requested_version = substr($requested_version, 1);
@@ -32,11 +32,11 @@ class Api extends MY_Controller {
$major = intval(explode(".", $requested_version)[0]);
if (!preg_match("/^[a-zA-Z-_]+$/", $controller)) {
- throw new \exceptions\PublicApiException("api/invalid-endpoint", "Invalid endpoint requested");
+ throw new \exceptions\UserInputException("api/invalid-endpoint", "Invalid endpoint requested");
}
if (!preg_match("/^[a-zA-Z-_]+$/", $function)) {
- throw new \exceptions\PublicApiException("api/invalid-endpoint", "Invalid endpoint requested");
+ throw new \exceptions\UserInputException("api/invalid-endpoint", "Invalid endpoint requested");
}
$namespace = "controllers\\api\\v".$major;
@@ -44,16 +44,16 @@ class Api extends MY_Controller {
$class_info = $namespace."\\api_info";
if (!class_exists($class_info) || version_compare($class_info::get_version(), $requested_version, "<")) {
- throw new \exceptions\PublicApiException("api/version-not-supported", "Requested API version is not supported");
+ throw new \exceptions\UserInputException("api/version-not-supported", "Requested API version is not supported");
}
if (!class_exists($class)) {
- throw new \exceptions\PublicApiException("api/unknown-endpoint", "Unknown endpoint requested");
+ throw new \exceptions\UserInputException("api/unknown-endpoint", "Unknown endpoint requested");
}
$c= new $class;
if (!method_exists($c, $function)) {
- throw new \exceptions\PublicApiException("api/unknown-endpoint", "Unknown endpoint requested");
+ throw new \exceptions\UserInputException("api/unknown-endpoint", "Unknown endpoint requested");
}
return $this->send_json_reply($c->$function());
} catch (\exceptions\PublicApiException $e) {
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");
diff --git a/application/controllers/api/v2/file.php b/application/controllers/api/v2/file.php
index 3d4103f1c..6da0d8155 100644
--- a/application/controllers/api/v2/file.php
+++ b/application/controllers/api/v2/file.php
@@ -24,7 +24,7 @@ class file extends \controllers\api\api_controller {
$files = getNormalizedFILES();
if (empty($files)) {
- throw new \exceptions\PublicApiException("file/no-file", "No file was uploaded or unknown error occurred.");
+ throw new \exceptions\UserInputException("file/no-file", "No file was uploaded or unknown error occurred.");
}
\service\files::verify_uploaded_files($files);