summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-03-13 10:20:09 (GMT)
committerAleksander Machniak <alec@alec.pl>2015-03-13 10:20:09 (GMT)
commit5fe3349e6c1a12395413682caf58baf862095c45 (patch)
tree2c13a7099703ac21e3399c92f46ee9924153e129
parent74413c0812a9cb25ee18e5c0ad709b2168d03cb3 (diff)
downloadkolab-chwala-master.tar.gz
Be more specific on storage errors (#4843)HEADchwala-0.3.1master
-rw-r--r--lib/drivers/kolab/kolab_file_storage.php9
-rw-r--r--lib/file_storage.php4
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/drivers/kolab/kolab_file_storage.php b/lib/drivers/kolab/kolab_file_storage.php
index c7cdc8a..d623b39 100644
--- a/lib/drivers/kolab/kolab_file_storage.php
+++ b/lib/drivers/kolab/kolab_file_storage.php
@@ -1077,6 +1077,15 @@ class kolab_file_storage implements file_storage
$folder = kolab_storage::get_folder($imap_name, 'file');
if (!$folder || !$folder->valid) {
+ $error = $folder->get_error();
+
+ if ($error === kolab_storage::ERROR_IMAP_CONN || $error === kolab_storage::ERROR_CACHE_DB) {
+ throw new Exception("The storage is temporarily unavailable.", file_storage::ERROR_UNAVAILABLE);
+ }
+ else if ($error === kolab_storage::ERROR_NO_PERMISSION) {
+ throw new Exception("Storage error. Access not permitted", file_storage::ERROR_FORBIDDEN);
+ }
+
throw new Exception("Storage error. Folder not found.", file_storage::ERROR);
}
diff --git a/lib/file_storage.php b/lib/file_storage.php
index d2b9c55..0f2d95d 100644
--- a/lib/file_storage.php
+++ b/lib/file_storage.php
@@ -36,8 +36,10 @@ interface file_storage
const SEPARATOR = '/';
// error codes
- const ERROR = 500;
const ERROR_LOCKED = 423;
+ const ERROR = 500;
+ const ERROR_UNAVAILABLE = 503;
+ const ERROR_FORBIDDEN = 530;
const ERROR_FILE_EXISTS = 550;
const ERROR_UNSUPPORTED = 570;
const ERROR_NOAUTH = 580;