diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-11-02 18:05:14 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-11-02 18:05:14 +0100 |
commit | 4623b70cc996b5ba0353bc8eea0156ed1d983c6c (patch) | |
tree | c0e4478de0cfb8b181f88dcf53a1d86a82503158 /apps/federatedfilesharing/lib/FederatedShareProvider.php | |
parent | e81d04cd8d2ac0de3d06d4586550469384c5d91a (diff) | |
download | nextcloud-server-4623b70cc996b5ba0353bc8eea0156ed1d983c6c.tar.gz nextcloud-server-4623b70cc996b5ba0353bc8eea0156ed1d983c6c.zip |
catch all exception and return a user friendly exception message
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/federatedfilesharing/lib/FederatedShareProvider.php')
-rw-r--r-- | apps/federatedfilesharing/lib/FederatedShareProvider.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 270bf86daf7..6481abe32e2 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -222,6 +222,8 @@ class FederatedShareProvider implements IShareProvider { $token ); + $failure = false; + try { $sharedByFederatedId = $share->getSharedBy(); if ($this->userManager->userExists($sharedByFederatedId)) { @@ -239,17 +241,22 @@ class FederatedShareProvider implements IShareProvider { ); if ($send === false) { - $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.', - [$share->getNode()->getName(), $share->getSharedWith()]); - throw new \Exception($message_t); + $failure = true; } } catch (\Exception $e) { $this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')'); + $failure = true; + } + + if($failure) { $this->removeShareFromTableById($shareId); - throw $e; + $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.', + [$share->getNode()->getName(), $share->getSharedWith()]); + throw new \Exception($message_t); } return $shareId; + } /** |