diff options
-rw-r--r-- | lib/drivers/kolab/kolab_file_storage.php | 9 | ||||
-rw-r--r-- | lib/file_storage.php | 4 |
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; |