mirror of https://github.com/MISP/MISP
fix: [modules] Better error handling for connection problems
parent
0ff3e0602c
commit
54fa714c29
|
@ -256,6 +256,12 @@ class Module extends AppModel
|
|||
}
|
||||
$response = $httpSocket->get($url . $uri, false, $request);
|
||||
}
|
||||
if (!$response->isOk()) {
|
||||
if ($httpSocket->lastError()) {
|
||||
throw new Exception("Failed to get response from $moduleFamily module " . $httpSocket->lastError());
|
||||
}
|
||||
throw new Exception("Failed to get response from $moduleFamily module: HTTP $response->reasonPhrase", (int)$response->code);
|
||||
}
|
||||
return $this->jsonDecode($response->body);
|
||||
} catch (Exception $e) {
|
||||
$this->logException('Failed to query module ' . $moduleFamily, $e);
|
||||
|
|
Loading…
Reference in New Issue