Skip to content

Commit 612d84e

Browse files
committed
better error handling for search tickets
1 parent 111890c commit 612d84e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/Zammad.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,9 @@ public function searchTickets($string, $page = null, $objects_per_page = null)
204204
if ($this->search)
205205
return $this->search;
206206

207-
if (empty($search))
208-
{
209-
return [];
210-
}
207+
if (!is_array($search)) {
208+
return $search->getError();
209+
}
211210

212211
return false;
213212
}
@@ -289,9 +288,8 @@ public function searchUsers($string, $page = null, $objects_per_page = null)
289288
if ($this->search)
290289
return $this->search;
291290

292-
if (empty($search))
293-
{
294-
return [];
291+
if (!is_array($search)) {
292+
return $search->getError();
295293
}
296294

297295
return false;
@@ -445,10 +443,9 @@ public function searchOrganizations($string, $page = null, $objects_per_page = n
445443
if ($this->search)
446444
return $this->search;
447445

448-
if (empty($search))
449-
{
450-
return [];
451-
}
446+
if (!is_array($search)) {
447+
return $search->getError();
448+
}
452449

453450
return false;
454451
}

0 commit comments

Comments
 (0)