From 1b21cde2b3c10b8a4756325039745f1ea9024769 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 6 Aug 2012 16:37:51 -0400 Subject: [PATCH] Throw more exceptions --- lib/public/share.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/public/share.php b/lib/public/share.php index f71b508978..df5ad82d7f 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -631,14 +631,16 @@ class Share { $fileSource = $checkReshare['file_source']; $fileTarget = $checkReshare['file_target']; } else { - \OC_Log::write('OCP\Share', 'Sharing '.$itemSource.' failed, because resharing is not allowed', \OC_Log::ERROR); - return false; + $message = 'Sharing '.$itemSource.' failed, because resharing is not allowed'; + \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); + throw new \Exception($message); } } else { $parent = null; if (!$backend->isValidSource($itemSource, $uidOwner)) { - \OC_Log::write('OCP\Share', 'Sharing '.$itemSource.' failed, because the sharing backend for '.$itemType.' could not find its source', \OC_Log::ERROR); - return false; + $message = 'Sharing '.$itemSource.' failed, because the sharing backend for '.$itemType.' could not find its source'; + \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); + throw new \Exception($message); } $parent = null; if ($backend instanceof Share_Backend_File_Dependent) { @@ -646,8 +648,9 @@ class Share { $filePath = $backend->getFilePath($itemSource, $uidOwner); $fileSource = \OC_FileCache::getId($filePath); if ($fileSource == -1) { - \OC_Log::write('OCP\Share', 'Sharing '.$itemSource.' failed, because the file could not be found in the file cache', \OC_Log::ERROR); - return false; + $message = 'Sharing '.$itemSource.' failed, because the file could not be found in the file cache'; + \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); + throw new \Exception($message); } } else { $fileSource = null;