diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-05-27 10:37:12 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-05-27 21:00:02 +0200 |
commit | 5549641f1f977ab2b105b8f9d7b8c6829c0e6d02 (patch) | |
tree | d2aed27bfc9ea13b29be2c9688f68b5e8763c8d0 /lib/private/encryption | |
parent | 3de945d13da0016cd8c602867ff18a33c2534418 (diff) | |
download | nextcloud-server-5549641f1f977ab2b105b8f9d7b8c6829c0e6d02.tar.gz nextcloud-server-5549641f1f977ab2b105b8f9d7b8c6829c0e6d02.zip |
improve error messages displayed to the user
Diffstat (limited to 'lib/private/encryption')
-rw-r--r-- | lib/private/encryption/exceptions/decryptionfailedexception.php | 11 | ||||
-rw-r--r-- | lib/private/encryption/manager.php | 11 |
2 files changed, 9 insertions, 13 deletions
diff --git a/lib/private/encryption/exceptions/decryptionfailedexception.php b/lib/private/encryption/exceptions/decryptionfailedexception.php index 7e9fa21eaef..406ae12968e 100644 --- a/lib/private/encryption/exceptions/decryptionfailedexception.php +++ b/lib/private/encryption/exceptions/decryptionfailedexception.php @@ -27,15 +27,4 @@ use OCP\Encryption\Exceptions\GenericEncryptionException; class DecryptionFailedException extends GenericEncryptionException { - /** - * @param string $message - * @param int $code - * @param \Exception $previous - * @param string $hint - */ - public function __construct($message = '', $code = 0, \Exception $previous = null, $hint = '') { - parent::__construct($message, $code, $previous, $hint); - -} - } diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php index 45f45045643..6942376f0b7 100644 --- a/lib/private/encryption/manager.php +++ b/lib/private/encryption/manager.php @@ -30,6 +30,7 @@ use OCP\Encryption\IEncryptionModule; use OCP\Encryption\IManager; use OCP\Files\Mount\IMountPoint; use OCP\IConfig; +use OCP\IL10N; use OCP\ILogger; class Manager implements IManager { @@ -43,14 +44,19 @@ class Manager implements IManager { /** @var ILogger */ protected $logger; + /** @var Il10n */ + protected $l; + /** * @param IConfig $config * @param ILogger $logger + * @param IL10N $l10n */ - public function __construct(IConfig $config, ILogger $logger) { + public function __construct(IConfig $config, ILogger $logger, IL10N $l10n) { $this->encryptionModules = array(); $this->config = $config; $this->logger = $logger; + $this->l = $l10n; } /** @@ -145,7 +151,8 @@ class Manager implements IManager { return call_user_func($this->encryptionModules[$moduleId]['callback']); } else { $message = "Module with id: $moduleId does not exists."; - throw new Exceptions\ModuleDoesNotExistsException($message); + $hint = $this->l->t('Module with id: %s does not exists. Please enable it in your apps settings or contact your administrator.', [$moduleId]); + throw new Exceptions\ModuleDoesNotExistsException($message, $hint); } } else { return $this->getDefaultEncryptionModule(); |