Update 'src/reporter.php'
Style changes
This commit is contained in:
parent
fd582d85d0
commit
dd78ef0770
@ -22,7 +22,8 @@ if ($ipAddress == $config['security']['ignoreip'])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
$response = $client->request('POST', 'report', [
|
||||
'query' => [
|
||||
'ip' => $ipAddress,
|
||||
@ -37,12 +38,17 @@ try {
|
||||
|
||||
$logger->info(sprintf("Reported %s to AbuseIPDB.", $ipAddress), json_decode($response->getBody(), true));
|
||||
|
||||
} catch(GuzzleHttp\Exception\ClientException $e) {
|
||||
}
|
||||
catch(GuzzleHttp\Exception\ClientException $e)
|
||||
{
|
||||
|
||||
$body = json_decode($e->getResponse()->getBody()->getContents(), true);
|
||||
$logger->error("REPORTER: Failed to report $ipAddress. Check context for details.", $body);
|
||||
exit(1);
|
||||
} catch(GuzzleHttp\Exception\ServerException $se) {
|
||||
$body = json_decode($e->getResponse()->getBody()->getContents(), true);
|
||||
$logger->error("REPORTER: Failed to report $ipAddress. Check context for details.", $body);
|
||||
exit(1);
|
||||
|
||||
}
|
||||
catch(GuzzleHttp\Exception\ServerException $se)
|
||||
{
|
||||
$logger->error("Failed to report $ipAddress due to server error.", ['message' => $se->getMessage()]);
|
||||
exit(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user