Merge pull request #7338 from nextcloud/fix_exception_on_unreachable_server

Do not log Exception if a connection error occured
This commit is contained in:
Roeland Jago Douma 2017-11-29 16:03:23 +01:00 committed by GitHub
commit a9eb0d4a40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@
namespace OCA\Federation\BackgroundJob; namespace OCA\Federation\BackgroundJob;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use OC\BackgroundJob\JobList; use OC\BackgroundJob\JobList;
use OC\BackgroundJob\Job; use OC\BackgroundJob\Job;
use OCA\Federation\DbHandler; use OCA\Federation\DbHandler;
@ -196,6 +197,8 @@ class GetSharedSecret extends Job {
} else { } else {
$this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
} }
} catch (ConnectException $e) {
$this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
} catch (\Exception $e) { } catch (\Exception $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR; $status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']); $this->logger->logException($e, ['app' => 'federation']);

View File

@ -32,6 +32,7 @@ namespace OCA\Federation\BackgroundJob;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use OC\BackgroundJob\JobList; use OC\BackgroundJob\JobList;
use OC\BackgroundJob\Job; use OC\BackgroundJob\Job;
use OCA\Federation\DbHandler; use OCA\Federation\DbHandler;
@ -196,6 +197,8 @@ class RequestSharedSecret extends Job {
} else { } else {
$this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
} }
} catch (ConnectException $e) {
$this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
} catch (\Exception $e) { } catch (\Exception $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR; $status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']); $this->logger->logException($e, ['app' => 'federation']);