Merge pull request #8789 from nextcloud/proper-exception-logging

Use proper method to log exceptions
This commit is contained in:
Roeland Jago Douma 2018-03-12 22:01:10 +01:00 committed by GitHub
commit 66173e9b52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 17 deletions

View file

@ -81,7 +81,7 @@ try {
OCP\JSON::success(array('data' => $data));
} catch (\OCP\Files\StorageNotAvailableException $e) {
\OCP\Util::logException('files', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
OCP\JSON::error([
'data' => [
'exception' => StorageNotAvailableException::class,
@ -89,7 +89,7 @@ try {
]
]);
} catch (\OCP\Files\StorageInvalidException $e) {
\OCP\Util::logException('files', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
OCP\JSON::error(array(
'data' => array(
'exception' => StorageInvalidException::class,
@ -97,7 +97,7 @@ try {
)
));
} catch (\Exception $e) {
\OCP\Util::logException('files', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
OCP\JSON::error(array(
'data' => array(
'exception' => \Exception::class,

View file

@ -194,7 +194,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
));
$this->testTimeout();
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
@ -261,7 +261,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
// we reached the end when the list is no longer truncated
} while ($objects['IsTruncated']);
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
return true;
@ -305,7 +305,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return IteratorDirectory::wrap($files);
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
}
@ -333,7 +333,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return $stat;
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
}
@ -343,7 +343,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
try {
return $this->isRoot($path) || $this->headObject($path . '/');
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
}
@ -363,7 +363,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return 'dir';
}
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
@ -389,7 +389,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$this->deleteObject($path);
$this->invalidateCache($path);
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
@ -405,7 +405,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
try {
return $this->readObject($path);
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
case 'w':
@ -483,7 +483,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$this->testTimeout();
}
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
@ -504,7 +504,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
));
$this->testTimeout();
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
} else {
@ -518,7 +518,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
));
$this->testTimeout();
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
@ -591,7 +591,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
unlink($tmpFile);
return true;
} catch (S3Exception $e) {
\OCP\Util::logException('files_external', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
return false;
}
}

View file

@ -247,7 +247,7 @@ class OC_Mount_Config {
throw $e;
}
} catch (Exception $exception) {
\OCP\Util::logException('files_external', $exception);
\OC::$server->getLogger()->logException($exception, ['app' => 'files_external']);
throw $exception;
}
}

View file

@ -426,7 +426,7 @@ class OC {
// if session can't be started break with http 500 error
} catch (Exception $e) {
\OCP\Util::logException('base', $e);
\OC::$server->getLogger()->logException($e, ['app' => 'base']);
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($e);