Updated error codes

This commit is contained in:
Pierre 2017-06-19 10:36:39 +02:00
parent d9eeddb131
commit 943f03ee98
3 changed files with 19 additions and 4 deletions

View File

@ -67,7 +67,7 @@ class conversationsController{
//Check for parametres
if(!check_post_parametres(array("name", "follow", "users")))
Rest_fatal_error(501, "Please check parametres passed with the request !");
Rest_fatal_error(400, "Please check parametres passed with the request !");
//Extract parametres
$conversationName = ($_POST["name"] == "false" ? false : $_POST['name']);
@ -106,7 +106,7 @@ class conversationsController{
//Check conversation ID was specified
if(!isset($_POST["conversationID"]))
Rest_fatal_error("501", "Please specify a conversation ID !");
Rest_fatal_error(400, "Please specify a conversation ID !");
$conversationID = toInt($_POST["conversationID"]);
//Check if the user is a conversation moderator or not
@ -156,4 +156,19 @@ class conversationsController{
//Success
return array("success" => "Conversation informations were successfully updated !");
}
/**
* Find (create ?) and return private conversation ID
*
* @url POST /conversations/getPrivate
*/
public function findPrivate(){
user_login_required();
//Check for parametres
if(!isset($_POST['user1']) OR !isset($_POST['user2']))
Rest_fatal_error(400, "Please check your parametres")
}
}

View File

@ -36,7 +36,7 @@ class friendsController{
//Check parametres
if(!isset($_POST["friendID"]) OR !isset($_POST['accept']))
Rest_fatal_error(501, "Please check your parametres !");
Rest_fatal_error(400, "Please check your parametres !");
//Extract informations and process request
$friendID = toInt($_POST['friendID']);

View File

@ -18,7 +18,7 @@ class userController
public function connectUSER(){
//Check variables sent in request
if(!isset($_POST['userMail']) OR !isset($_POST['userPassword']))
throw new RestException(401, "Missing data !");
throw new RestException(400, "Missing data !");
//Retrieve database connection
$db = CS::get()->db;;