diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 4dadcdbfcd7f4..219f3d86380a5 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -99,7 +99,7 @@ private function splitFullId($id) { * Verify if a password meets all requirements * * @param string $password - * @throws \Exception + * @throws HintException */ protected function verifyPassword($password) { if ($password === null) { @@ -115,7 +115,8 @@ protected function verifyPassword($password) { try { $this->dispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password)); } catch (HintException $e) { - throw new \Exception($e->getHint()); + /* Wrap in a 400 bad request error */ + throw new HintException($e->getMessage(), $e->getHint(), 400, $e); } } @@ -784,7 +785,7 @@ public function createShare(IShare $share) { * @param IShare $share * @return IShare The share object * @throws \InvalidArgumentException - * @throws GenericShareException + * @throws HintException */ public function updateShare(IShare $share, bool $onlyValid = true) { $expirationDateUpdated = false; diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 79a88f9af9efd..091a79e6d40a7 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -798,7 +798,7 @@ public function testVerifyPasswordHookFails(): void { $this->assertInstanceOf(ValidatePasswordPolicyEvent::class, $event); /** @var ValidatePasswordPolicyEvent $event */ $this->assertSame('password', $event->getPassword()); - throw new HintException('message', 'password not accepted'); + throw new HintException('password not accepted'); } );