From 098d918bafde6bef10336e9c1b97d76f2862602f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 22 Apr 2021 08:14:48 +0200 Subject: [PATCH 1/2] Add proper message to created share not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- lib/private/Share20/DefaultShareProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 00ef7e2426b9b..5e08b3da76847 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -223,7 +223,7 @@ public function create(\OCP\Share\IShare $share) { $cursor->closeCursor(); if ($data === false) { - throw new ShareNotFound(); + throw new ShareNotFound('Newly created share could not be found'); } $mailSendValue = $share->getMailSend(); From d578d780e460f409c4556553173db9766e840292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 22 Apr 2021 08:48:25 +0200 Subject: [PATCH 2/2] Default message for ShareNotFound exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- lib/public/Share/Exceptions/ShareNotFound.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/public/Share/Exceptions/ShareNotFound.php b/lib/public/Share/Exceptions/ShareNotFound.php index 12cdbf4fd9cb7..790b11be95acc 100644 --- a/lib/public/Share/Exceptions/ShareNotFound.php +++ b/lib/public/Share/Exceptions/ShareNotFound.php @@ -28,4 +28,18 @@ * @since 9.0.0 */ class ShareNotFound extends GenericShareException { + + /** + * @param string $message + * @param string $hint + * @param int $code + * @param \Exception|null $previous + * @since 9.0.0 + */ + public function __construct($message = '', ...$arguments) { + if (empty($message)) { + $message = 'Share not found'; + } + parent::__construct($message, ...$arguments); + } }