Browse Source

Merge pull request #26688 from nextcloud/enh/better-share-exceptiondebug

John Molakvoæ 2 years ago
parent
commit
b585cf1ea1

+ 1 - 1
lib/private/Share20/DefaultShareProvider.php

@@ -222,7 +222,7 @@ class DefaultShareProvider implements IShareProvider {
 		$cursor->closeCursor();
 
 		if ($data === false) {
-			throw new ShareNotFound();
+			throw new ShareNotFound('Newly created share could not be found');
 		}
 
 		$mailSendValue = $share->getMailSend();

+ 14 - 0
lib/public/Share/Exceptions/ShareNotFound.php

@@ -27,4 +27,18 @@ namespace OCP\Share\Exceptions;
  * @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);
+	}
 }