*
* Storage backends with eventual consistency might return stale data.
*
+ * Failures during iteration can result in FileBackendError exceptions (since 1.22).
+ *
* @param array $params
* $params include:
* - dir : storage directory
*
* Storage backends with eventual consistency might return stale data.
*
+ * Failures during iteration can result in FileBackendError exceptions (since 1.22).
+ *
* @param array $params
* $params include:
* - dir : storage directory
*
* Storage backends with eventual consistency might return stale data.
*
+ * Failures during iteration can result in FileBackendError exceptions (since 1.22).
+ *
* @param array $params
* $params include:
* - dir : storage directory
*
* Storage backends with eventual consistency might return stale data.
*
+ * Failures during iteration can result in FileBackendError exceptions (since 1.22).
+ *
* @param array $params
* $params include:
* - dir : storage directory
return $path;
}
}
+
+/**
+ * @ingroup FileBackend
+ * @since 1.22
+ */
+class FileBackendError extends MWException {}
* @param integer $limit Max number of items to list
* @param array $params Parameters for getDirectoryList()
* @return Array List of resolved paths of directories directly under $dir
+ * @throws FileBackendError
*/
public function getDirListPageInternal( $fullCont, $dir, &$after, $limit, array $params ) {
$dirs = array();
return $dirs; // nothing more
}
- wfProfileIn( __METHOD__ . '-' . $this->name );
+ $section = new ProfileSection( __METHOD__ . '-' . $this->name );
try {
$container = $this->getContainer( $fullCont );
$prefix = ( $dir == '' ) ? null : "{$dir}/";
} catch ( CloudFilesException $e ) { // some other exception?
$this->handleException( $e, null, __METHOD__,
array( 'cont' => $fullCont, 'dir' => $dir ) );
+ throw new FileBackendError( "Got " . get_class( $e ) . " exception." );
}
- wfProfileOut( __METHOD__ . '-' . $this->name );
return $dirs;
}
* @param integer $limit Max number of items to list
* @param array $params Parameters for getDirectoryList()
* @return Array List of resolved paths of files under $dir
+ * @throws FileBackendError
*/
public function getFileListPageInternal( $fullCont, $dir, &$after, $limit, array $params ) {
$files = array();
return $files; // nothing more
}
- wfProfileIn( __METHOD__ . '-' . $this->name );
+ $section = new ProfileSection( __METHOD__ . '-' . $this->name );
try {
$container = $this->getContainer( $fullCont );
$prefix = ( $dir == '' ) ? null : "{$dir}/";
} catch ( CloudFilesException $e ) { // some other exception?
$this->handleException( $e, null, __METHOD__,
array( 'cont' => $fullCont, 'dir' => $dir ) );
+ throw new FileBackendError( "Got " . get_class( $e ) . " exception." );
}
- wfProfileOut( __METHOD__ . '-' . $this->name );
return $files;
}
* @param string $after|null
* @param integer $limit
* @param array $params
- * @return Traversable|Array|null Returns null on failure
+ * @return Traversable|Array
*/
abstract protected function pageFromList( $container, $dir, &$after, $limit, array $params );
}
/**
* @see SwiftFileBackendList::pageFromList()
- * @return Array|null
+ * @return Array
*/
protected function pageFromList( $container, $dir, &$after, $limit, array $params ) {
return $this->backend->getDirListPageInternal( $container, $dir, $after, $limit, $params );
/**
* @see SwiftFileBackendList::pageFromList()
- * @return Array|null
+ * @return Array
*/
protected function pageFromList( $container, $dir, &$after, $limit, array $params ) {
return $this->backend->getFileListPageInternal( $container, $dir, $after, $limit, $params );