Esempio n. 1
0
 /**
  * Convert sabre DAV exception to a storage exception,
  * then throw it
  *
  * @param \Sabre\Dav\Exception $e sabre exception
  * @throws StorageInvalidException if the storage is invalid, for example
  * when the authentication expired or is invalid
  * @throws StorageNotAvailableException if the storage is not available,
  * which might be temporary
  */
 private function convertSabreException(\Sabre\Dav\Exception $e)
 {
     \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
     if ($e instanceof \Sabre\DAV\Exception\NotAuthenticated) {
         // either password was changed or was invalid all along
         throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage());
     } else {
         if ($e instanceof \Sabre\DAV\Exception\MethodNotAllowed) {
             // ignore exception, false will be returned
             return;
         }
     }
     throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
 }