summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-21 17:32:39 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-12 14:24:47 +0100
commit94856cb892bba5b123c3f7e9ebeb042c960f72dd (patch)
tree7e1c3fcc1e929cf2d79116e09c3211c2803edad1
parentca8c9f6ad52c6171fdecc2348fefbeef7cc5d2a3 (diff)
downloadnextcloud-server-94856cb892bba5b123c3f7e9ebeb042c960f72dd.tar.gz
nextcloud-server-94856cb892bba5b123c3f7e9ebeb042c960f72dd.zip
Catch exceptions during sync
-rw-r--r--apps/dav/lib/carddav/syncservice.php5
-rw-r--r--apps/federation/command/syncfederationaddressbooks.php10
2 files changed, 8 insertions, 7 deletions
diff --git a/apps/dav/lib/carddav/syncservice.php b/apps/dav/lib/carddav/syncservice.php
index 494db61d989..b8dfcfdbc5e 100644
--- a/apps/dav/lib/carddav/syncservice.php
+++ b/apps/dav/lib/carddav/syncservice.php
@@ -24,6 +24,7 @@ namespace OCA\DAV\CardDAV;
use Sabre\DAV\Client;
use Sabre\DAV\Xml\Response\MultiStatus;
use Sabre\DAV\Xml\Service;
+use Sabre\HTTP\ClientException;
class SyncService {
@@ -112,10 +113,6 @@ class SyncService {
'Content-Type' => 'application/xml'
]);
-// if ((int)$response->getStatus() >= 400) {
-// throw new Exception('HTTP error: ' . $response->getStatus());
-// }
-
$result = $this->parseMultiStatus($response['body']);
return $result;
diff --git a/apps/federation/command/syncfederationaddressbooks.php b/apps/federation/command/syncfederationaddressbooks.php
index d7761d14814..9fb1e51f643 100644
--- a/apps/federation/command/syncfederationaddressbooks.php
+++ b/apps/federation/command/syncfederationaddressbooks.php
@@ -63,9 +63,13 @@ class SyncFederationAddressBooks extends Command {
$targetBookProperties = [
'{DAV:}displayname' => $url
];
- $newToken = $this->syncService->syncRemoteAddressBook($url, 'system', $sharedSecret, $syncToken, $targetPrincipal, $targetBookId, $targetBookProperties);
- if ($newToken !== $syncToken) {
- $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_OK, $newToken);
+ try {
+ $newToken = $this->syncService->syncRemoteAddressBook($url, 'system', $sharedSecret, $syncToken, $targetPrincipal, $targetBookId, $targetBookProperties);
+ if ($newToken !== $syncToken) {
+ $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_OK, $newToken);
+ }
+ } catch (\Exception $ex) {
+ $output->writeln("Error while syncing $url : " . $ex->getMessage());
}
}
$progress->finish();