summaryrefslogtreecommitdiffstats
path: root/application/controllers/api.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-01-11 01:39:22 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-01-16 17:38:38 +0100
commit434143c2b01c203bf9030669a14055872121b2c0 (patch)
tree129d606d3e0f3082b65f7c379a7fd2aa3e94286b /application/controllers/api.php
parent9670d794be886c036408de85773a0b7d204979b9 (diff)
improve api errors
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/api.php')
-rw-r--r--application/controllers/api.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/application/controllers/api.php b/application/controllers/api.php
index a7bd09f34..7557c6c99 100644
--- a/application/controllers/api.php
+++ b/application/controllers/api.php
@@ -24,11 +24,11 @@ class Api extends MY_Controller {
$major = intval(explode(".", $requested_version)[0]);
if (!preg_match("/^[a-zA-Z-_]+$/", $controller)) {
- return send_json_error_reply("Invalid controller requested");
+ return send_json_error_reply("api/invalid-controller-value", "Invalid controller requested");
}
if (!preg_match("/^[a-zA-Z-_]+$/", $function)) {
- return send_json_error_reply("Invalid function requested");
+ return send_json_error_reply("api/invalid-function-value", "Invalid function requested");
}
$namespace = "controllers\\api\\v".$major;
@@ -36,16 +36,16 @@ class Api extends MY_Controller {
$class_info = $namespace."\\api_info";
if (!class_exists($class_info) || version_compare($class_info::get_version(), $requested_version, "<")) {
- return send_json_error_reply("Requested API version is not supported");
+ return send_json_error_reply("api/version-not-supported", "Requested API version is not supported");
}
if (!class_exists($class)) {
- return send_json_error_reply("Unknown controller requested");
+ return send_json_error_reply("api/unknown-controller", "Unknown controller requested");
}
$c= new $class;
if (!method_exists($c, $function)) {
- return send_json_error_reply("Unknown function requested");
+ return send_json_error_reply("api/unknown-function", "Unknown function requested");
}
return $c->$function();
}