summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-02-14 19:10:19 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-02-14 19:11:47 +0100
commitbfbbf4082779a7535cac2fb270fd928178ae7e70 (patch)
treee8d5dfbd16c68c6a943a7d7465df9321e2d7eb74 /application
parentcb2df59b45d4cb35790472f76b06c59b22c6213b (diff)
Unify exceptions for unknown/invalid endpoints
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/api.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/application/controllers/api.php b/application/controllers/api.php
index 837f62e89..644a726e7 100644
--- a/application/controllers/api.php
+++ b/application/controllers/api.php
@@ -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-controller-value", "Invalid controller requested");
+ throw new \exceptions\PublicApiException("api/invalid-endpoint", "Invalid endpoint requested");
}
if (!preg_match("/^[a-zA-Z-_]+$/", $function)) {
- throw new \exceptions\PublicApiException("api/invalid-function-value", "Invalid function requested");
+ throw new \exceptions\PublicApiException("api/invalid-endpoint", "Invalid endpoint requested");
}
$namespace = "controllers\\api\\v".$major;
@@ -48,12 +48,12 @@ class Api extends MY_Controller {
}
if (!class_exists($class)) {
- throw new \exceptions\PublicApiException("api/unknown-controller", "Unknown controller requested");
+ throw new \exceptions\PublicApiException("api/unknown-endpoint", "Unknown endpoint requested");
}
$c= new $class;
if (!method_exists($c, $function)) {
- throw new \exceptions\PublicApiException("api/unknown-function", "Unknown function requested");
+ throw new \exceptions\PublicApiException("api/unknown-endpoint", "Unknown endpoint requested");
}
return send_json_reply($c->$function());
} catch (\exceptions\PublicApiException $e) {