2
0
forked from Wavyzz/dolibarr

->error rather than dol_print_error into product

This commit is contained in:
florian HENRY
2020-07-31 16:09:38 +02:00
parent f5d7e94d7e
commit e44a1fd33f
6 changed files with 38 additions and 17 deletions

View File

@@ -419,8 +419,10 @@ class Documents extends DolibarrApi
$object = new Product($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
if ($result==0) {
throw new RestException(404, 'Product not found');
} elseif ($result<0) {
throw new RestException(500, 'Error while fetching object: '.$object->error);
}
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
@@ -630,7 +632,7 @@ class Documents extends DolibarrApi
}
elseif ($result < 0)
{
throw new RestException(500, 'Error while fetching object.');
throw new RestException(500, 'Error while fetching object: '.$object->error);
}
}