mirror of
https://github.com/friendica/friendica
synced 2025-04-29 05:44:22 +02:00
Exception handling added at many places
This commit is contained in:
parent
e6daaf49ce
commit
518382036b
16 changed files with 174 additions and 44 deletions
|
@ -220,7 +220,12 @@ class Search
|
|||
$return = Contact::searchByName($search, $mode, true);
|
||||
} else {
|
||||
$p = $page > 1 ? 'p=' . $page : '';
|
||||
$curlResult = DI::httpClient()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), HttpClientAccept::JSON, [HttpClientOptions::REQUEST => HttpClientRequest::CONTACTDISCOVER]);
|
||||
try {
|
||||
$curlResult = DI::httpClient()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), HttpClientAccept::JSON, [HttpClientOptions::REQUEST => HttpClientRequest::CONTACTDISCOVER]);
|
||||
} catch (\Throwable $th) {
|
||||
Logger::notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
|
||||
return [];
|
||||
}
|
||||
if ($curlResult->isSuccess()) {
|
||||
$searchResult = json_decode($curlResult->getBodyString(), true);
|
||||
if (!empty($searchResult['profiles'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue