Properly hint exceptions thrown by getUserFolder

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-04-03 12:17:47 +02:00
parent fba7bcfcc4
commit 56aa8fd035
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
2 changed files with 8 additions and 2 deletions

View File

@ -35,6 +35,7 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Mount\Manager; use OC\Files\Mount\Manager;
use OC\Files\Mount\MountPoint; use OC\Files\Mount\MountPoint;
use OC\Hooks\PublicEmitter; use OC\Hooks\PublicEmitter;
use OC\User\NoUserException;
use OCP\Files\Config\IUserMountCache; use OCP\Files\Config\IUserMountCache;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
@ -352,7 +353,8 @@ class Root extends Folder implements IRootFolder {
* *
* @param string $userId user ID * @param string $userId user ID
* @return \OCP\Files\Folder * @return \OCP\Files\Folder
* @throws \OC\User\NoUserException * @throws NoUserException
* @throws NotPermittedException
*/ */
public function getUserFolder($userId) { public function getUserFolder($userId) {
$userObject = $this->userManager->get($userId); $userObject = $this->userManager->get($userId);
@ -367,7 +369,7 @@ class Root extends Folder implements IRootFolder {
'app' => 'files', 'app' => 'files',
] ]
); );
throw new \OC\User\NoUserException('Backends provided no user object'); throw new NoUserException('Backends provided no user object');
} }
$userId = $userObject->getUID(); $userId = $userObject->getUID();

View File

@ -25,6 +25,7 @@
namespace OCP\Files; namespace OCP\Files;
use OC\Hooks\Emitter; use OC\Hooks\Emitter;
use OC\User\NoUserException;
/** /**
* Interface IRootFolder * Interface IRootFolder
@ -39,6 +40,9 @@ interface IRootFolder extends Folder, Emitter {
* *
* @param string $userId user ID * @param string $userId user ID
* @return \OCP\Files\Folder * @return \OCP\Files\Folder
* @throws NoUserException
* @throws NotPermittedException
*
* @since 8.2.0 * @since 8.2.0
*/ */
public function getUserFolder($userId); public function getUserFolder($userId);