Skip to content

Commit

Permalink
also hard error if the home storage can't be created
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Sep 1, 2022
1 parent 1214c4f commit 466edc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ private function createStorage() {
$this->invalidStorage = true;
if ($this->mountPoint === '/') {
// the root storage could not be initialized, show the user!
throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', $exception->getCode(), $exception);
throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', (int)$exception->getCode(), $exception);
} elseif (substr_count($this->mountPoint, '/') == 2) { // home mount is `/<userid/`, all extra mounts have more /'s
throw new \Exception('The home storage could not be initialized. Please contact your local administrator.', (int)$exception->getCode(), $exception);
} else {
\OC::$server->get(LoggerInterface::class)->error($exception->getMessage(), ['exception' => $exception]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Files/Mount/MountPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testInvalidStorage() {
$mountPoint = new \OC\Files\Mount\MountPoint(
// just use this because a real class is needed
'\Test\Files\Mount\DummyStorage',
'/mountpoint',
'/mountpoint/test',
null,
$loader
);
Expand Down

0 comments on commit 466edc2

Please sign in to comment.