Fix error process
This commit is contained in:
parent
88692fe95d
commit
100827ae0b
@ -295,9 +295,12 @@ class Categories extends DolibarrApi
|
|||||||
|
|
||||||
$categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page);
|
$categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page);
|
||||||
|
|
||||||
if( ! count($categories)) {
|
if( ! is_array($categories)) {
|
||||||
|
if ($categories == 0) {
|
||||||
throw new RestException(404, 'No category found for this object');
|
throw new RestException(404, 'No category found for this object');
|
||||||
}
|
}
|
||||||
|
throw new RestException(500, 'Error when fetching object categories', array_merge(array($this->category->error), $this->category->errors));
|
||||||
|
}
|
||||||
return $categories;
|
return $categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user