summaryrefslogtreecommitdiffstats
path: root/lib/private/preferences.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/preferences.php')
-rw-r--r--lib/private/preferences.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/private/preferences.php b/lib/private/preferences.php
index 9f33136aeb2..cd4a9fd1c19 100644
--- a/lib/private/preferences.php
+++ b/lib/private/preferences.php
@@ -37,6 +37,7 @@
namespace OC;
use OCP\IDBConnection;
+use OCP\PreConditionNotMetException;
/**
@@ -111,10 +112,12 @@ class Preferences {
* will be added automagically.
*/
public function setValue($user, $app, $key, $value, $preCondition = null) {
- return $this->config->setUserValue($user, $app, $key, $value);
-
- // TODO maybe catch exceptions and then return false
- return true;
+ try {
+ $this->config->setUserValue($user, $app, $key, $value, $preCondition);
+ return true;
+ } catch(PreConditionNotMetException $e) {
+ return false;
+ }
}
/**