mirror of
https://github.com/nextcloud/server.git
synced 2026-06-04 22:35:24 -04:00
Merge pull request #22046 from owncloud/improved_error_handling
Improved error handling
This commit is contained in:
commit
1232943aaa
3 changed files with 10 additions and 4 deletions
|
|
@ -99,7 +99,7 @@ class OCSAuthAPI {
|
|||
$token = $this->request->getParam('token');
|
||||
|
||||
if ($this->trustedServers->isTrustedServer($url) === false) {
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server not trusted (' . $url . ') while requesting shared secret');
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
|
||||
return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ class OCSAuthAPI {
|
|||
// token wins
|
||||
$localToken = $this->dbHandler->getToken($url);
|
||||
if (strcmp($localToken, $token) > 0) {
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server (' . $url . ') presented lower token');
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server (' . $url . ') presented lower token', ['app' => 'federation']);
|
||||
return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
|
|
@ -134,12 +134,12 @@ class OCSAuthAPI {
|
|||
$token = $this->request->getParam('token');
|
||||
|
||||
if ($this->trustedServers->isTrustedServer($url) === false) {
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server not trusted (' . $url . ') while getting shared secret');
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']);
|
||||
return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
if ($this->isValidToken($url, $token) === false) {
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server (' . $url . ') didn\'t send a valid token (got ' . $token . ') while getting shared secret');
|
||||
$this->logger->log(\OCP\Util::ERROR, 'remote server (' . $url . ') didn\'t send a valid token (got ' . $token . ') while getting shared secret', ['app' => 'federation']);
|
||||
return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,9 @@ class GetSharedSecret extends QueuedJob{
|
|||
} catch (ClientException $e) {
|
||||
$status = $e->getCode();
|
||||
$this->logger->logException($e);
|
||||
} catch (\Exception $e) {
|
||||
$status = HTTP::STATUS_INTERNAL_SERVER_ERROR;
|
||||
$this->logger->logException($e);
|
||||
}
|
||||
|
||||
// if we received a unexpected response we try again later
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ class RequestSharedSecret extends QueuedJob {
|
|||
} catch (ClientException $e) {
|
||||
$status = $e->getCode();
|
||||
$this->logger->logException($e);
|
||||
} catch (\Exception $e) {
|
||||
$status = HTTP::STATUS_INTERNAL_SERVER_ERROR;
|
||||
$this->logger->logException($e);
|
||||
}
|
||||
|
||||
// if we received a unexpected response we try again later
|
||||
|
|
|
|||
Loading…
Reference in a new issue