summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-01 17:52:29 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-01 17:52:29 -0400
commit4933128850879f0e0590746b6742dafcf857e113 (patch)
tree9932c4f25e97d7fcc2f8f7165644212565a0247d /core/ajax
parent2201074e1f1e4ec3c2f60cac74d8168738d83650 (diff)
downloadnextcloud-server-4933128850879f0e0590746b6742dafcf857e113.tar.gz
nextcloud-server-4933128850879f0e0590746b6742dafcf857e113.zip
Throw exceptions in share API for UI to display
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 6f5b927c779..f7a41aa3a4a 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -25,9 +25,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['item']
switch ($_POST['action']) {
case 'share':
if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) {
- $return = OCP\Share::share($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']);
- // TODO May need to return private link
- ($return) ? OC_JSON::success() : OC_JSON::error();
+ try {
+ OCP\Share::share($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']);
+ // TODO May need to return private link
+ OC_JSON::success();
+ } catch (Exception $exception) {
+ OC_JSON::error(array('data' => array('message' => $exception->getMessage())));
+ }
}
break;
case 'unshare':