From 41179a1456f749ab4cdbe84aac91e45a65bb11ba Mon Sep 17 00:00:00 2001
From: Michael Gapczynski <GapczynskiM@gmail.com>
Date: Sun, 6 May 2012 19:06:24 -0400
Subject: [PATCH] Fix feedback for sharing errors

---
 apps/files_sharing/ajax/share.php | 8 ++++----
 apps/files_sharing/js/share.js    | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php
index 79ebf9187b..4478144e92 100755
--- a/apps/files_sharing/ajax/share.php
+++ b/apps/files_sharing/ajax/share.php
@@ -22,12 +22,12 @@ foreach ($sources as $source) {
 				OCP\JSON::success();
 			}
 		} catch (Exception $exception) {
-			OCP\Util::writeLog('files_sharing', 'Unexpected Error : '.$exception->getMessage(),OCP\Util::ERROR);
-			OCP\JSON::error();
+			OCP\Util::writeLog('files_sharing', 'Unexpected Error : '.$exception->getMessage(), OCP\Util::ERROR);
+			OCP\JSON::error(array('data' => array('message' => $exception->getMessage())));
 		}
 	} else {
-		OCP\Util::writeLog('files_sharing', 'File does not exist or is not readable :'.$source,OCP\Util::ERROR);
-		OCP\JSON::error();
+		OCP\Util::writeLog('files_sharing', 'File does not exist or is not readable :'.$source, OCP\Util::ERROR);
+		OCP\JSON::error(array('data' => array('message' => 'File does not exist or is not readable')));
 	}
 }
 
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index e9b46873d3..7bfaa1f0c6 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -35,7 +35,7 @@ OC.Share={
 					callback(result.data);
 				}
 			} else {
-				OC.dialogs.alert('Error', 'Error while sharing');
+				OC.dialogs.alert(result.data.message, 'Error while sharing');
 			}
 		});
 	},
-- 
GitLab