diff --git a/src/reporter.php b/src/reporter.php index 078fb19..41c8497 100755 --- a/src/reporter.php +++ b/src/reporter.php @@ -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);