diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 6fad266ea36..d30e851b9a2 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -358,7 +358,7 @@ class Members extends DolibarrApi if ($member->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } else { - throw new RestException(500, $member->error); + throw new RestException(500, 'Error when updating member: '.$member->error); } } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index be8f22f3c45..d95de755166 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -204,7 +204,7 @@ class MembersTypes extends DolibarrApi if ($membertype->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } else { - throw new RestException(500, $membertype->error); + throw new RestException(500, 'Error when updating member type: '.$membertype->error); } } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 55b93df7663..f969017146b 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -159,7 +159,7 @@ class Subscriptions extends DolibarrApi $subscription->$field = $value; } if ($subscription->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors)); + throw new RestException(500, 'Error when creating contribution', array_merge(array($subscription->error), $subscription->errors)); } return $subscription->id; } @@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi if ($subscription->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { - throw new RestException(500, $subscription->error); + throw new RestException(500, 'Error when updating contribution: '.$subscription->error); } } diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 28dbef6887e..da49e4cbba7 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -126,7 +126,7 @@ class Documents extends DolibarrApi * @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language). * @return array List of documents * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 501 * @throws RestException 400 * @throws RestException 401 @@ -249,7 +249,7 @@ class Documents extends DolibarrApi * @throws RestException 400 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @url GET / */ @@ -546,7 +546,7 @@ class Documents extends DolibarrApi * @throws RestException 400 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @url POST /upload */ diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 41ed388e044..2cc17987224 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -533,7 +533,7 @@ class Proposals extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -707,7 +707,7 @@ class Proposals extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 48865f958a2..fb912139d5f 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -574,7 +574,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -704,7 +704,7 @@ class Orders extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ @@ -974,7 +974,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function getOrderShipments($id) { @@ -1030,7 +1030,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function createOrderShipment($id, $warehouse_id) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 8282610d01d..61f0a9e8d15 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -507,7 +507,7 @@ class Invoices extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -649,7 +649,7 @@ class Invoices extends DolibarrApi $result = $this->invoice->delete(DolibarrApiAccess::$user); if ($result < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting invoice'); } return array( @@ -768,7 +768,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * */ public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) @@ -817,7 +817,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * */ public function settodraft($id, $idwarehouse = -1) @@ -920,7 +920,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function settopaid($id, $close_code = '', $close_note = '') { @@ -970,7 +970,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function settounpaid($id) { @@ -1057,7 +1057,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function markAsCreditAvailable($id) { diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 597f15b7f10..f9af0568bf0 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -293,7 +293,7 @@ class Donations extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index df942ff93e6..37319a3ec71 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -401,7 +401,7 @@ class ExpenseReports extends DolibarrApi * * @throws RestException 401 Not allowed * @throws RestException 404 Expense report not found - * @throws RestException 500 + * @throws RestException 500 System error */ public function put($id, $request_data = null) { diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 06c836b4d77..35e783729ff 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -211,7 +211,7 @@ class SupplierInvoices extends DolibarrApi * @return int ID of supplier invoice * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error */ public function post($request_data = null) { @@ -283,7 +283,7 @@ class SupplierInvoices extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function delete($id) { @@ -300,7 +300,7 @@ class SupplierInvoices extends DolibarrApi } if ($this->invoice->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting invoice'); } return array( @@ -326,7 +326,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 * @throws RestException 405 - * @throws RestException 500 + * @throws RestException 500 System error */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index e21eb3436dc..d55a398dbd6 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -309,7 +309,7 @@ class SupplierOrders extends DolibarrApi } if ($this->order->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting order'); } return array( diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index ec735da3865..0f21b2aac3c 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -742,7 +742,7 @@ class Products extends DolibarrApi * @param int $fk_barcode_type Barcode type * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST {id}/purchase_prices @@ -1158,7 +1158,7 @@ class Products extends DolibarrApi * @param string $ref_ext External reference of Attribute * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/ref_ext/{ref_ext} @@ -1206,7 +1206,7 @@ class Products extends DolibarrApi * @param string $ref_ext Reference of Attribute * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST attributes @@ -1283,7 +1283,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute * @return int Result of deletion * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE attributes/{id} @@ -1311,7 +1311,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/values/{id} @@ -1352,7 +1352,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Attribute value * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/{id}/values/ref/{ref} @@ -1439,7 +1439,7 @@ class Products extends DolibarrApi * @return array * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error * * @url GET attributes/{id}/values */ @@ -1511,7 +1511,7 @@ class Products extends DolibarrApi * @param string $value Value of Attribute value * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST attributes/{id}/values @@ -1545,7 +1545,7 @@ class Products extends DolibarrApi * @return array * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error * * @url PUT attributes/values/{id} */ @@ -1590,7 +1590,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE attributes/values/{id} @@ -1617,7 +1617,7 @@ class Products extends DolibarrApi * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET {id}/variants @@ -1653,7 +1653,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Product * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET ref/{ref}/variants @@ -1695,7 +1695,7 @@ class Products extends DolibarrApi * @param string $ref_ext External reference of variant * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * @@ -1752,7 +1752,7 @@ class Products extends DolibarrApi * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * @@ -1807,7 +1807,7 @@ class Products extends DolibarrApi * @param array $request_data Datas * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url PUT variants/{id} @@ -1841,7 +1841,7 @@ class Products extends DolibarrApi * @param int $id ID of Variant * @return int Result of deletion * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE variants/{id} @@ -1869,7 +1869,7 @@ class Products extends DolibarrApi * @param int $selected_warehouse_id ID of warehouse * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 47e893846e6..962bbf021b8 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1409,7 +1409,7 @@ class Thirdparties extends DolibarrApi if ($result > 0) { return array("success" => $result); } else { - throw new RestException(500); + throw new RestException(500, 'Error generating the document '.$this->error); } } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 75c2db21224..3151f75877b 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -377,7 +377,7 @@ class Tickets extends DolibarrApi } $this->ticket->message = $ticketMessageText; if (!$this->ticket->createTicketMessage(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, 'Error when creating ticket'); } return $this->ticket->id; } @@ -438,7 +438,7 @@ class Tickets extends DolibarrApi } if (!$this->ticket->delete($id)) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting ticket'); } return array( diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 68aa2b650f7..66d842c3564 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -466,7 +466,7 @@ class Users extends DolibarrApi * * @throws RestException 401 Not allowed * @throws RestException 404 User not found - * @throws RestException 500 Error + * @throws RestException 500 System error * * @url GET {id}/setGroup/{group} */