mirror of https://github.com/MISP/MISP
Merge pull request #9635 from JakubOnderka/error-handling-sighting
chg: [internal] Better error handling when fetching sightingspull/9636/head
commit
0a77e3c3b8
|
@ -114,6 +114,10 @@ class HttpSocketResponseExtended extends HttpSocketResponse
|
|||
*/
|
||||
public function json()
|
||||
{
|
||||
if (strlen($this->body) === 0) {
|
||||
throw new HttpSocketJsonException('Could not parse empty response as JSON.', $this);
|
||||
}
|
||||
|
||||
try {
|
||||
return JsonTool::decode($this->body);
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -1445,7 +1445,7 @@ class Sighting extends AppModel
|
|||
try {
|
||||
$sightings = $serverSync->fetchSightingsForEvents($chunk);
|
||||
} catch (Exception $e) {
|
||||
$this->logException("Failed to download sightings from {$serverSync->server()['Server']['name']}.", $e);
|
||||
$this->logException("Failed to download sightings from remote server {$serverSync->server()['Server']['name']}.", $e);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue