Fix code from PR comments

This commit is contained in:
Jesús Macias 2015-11-26 08:26:07 +01:00 committed by Morris Jobke
parent 9d1ec02c5a
commit 4ead2bc861
6 changed files with 14 additions and 29 deletions

View File

@ -241,29 +241,9 @@ abstract class StoragesController extends Controller {
\OC_Mount_Config::STATUS_INDETERMINATE,
$this->l10n->t('Insufficient data: %s', [$e->getMessage()])
);
} catch (ExtStorageBadConfigException $e) {
$storage->setStatus(
$e->getCode(),
$this->l10n->t('%s', [$e->getMessage()])
);
} catch (ExtStorageAuthException $e) {
$storage->setStatus(
$e->getCode(),
$this->l10n->t('%s', [$e->getMessage()])
);
} catch (ExtStorageTimeoutException $e) {
$storage->setStatus(
$e->getCode(),
$this->l10n->t('%s', [$e->getMessage()])
);
} catch (ExtStorageConnectionException $e) {
$storage->setStatus(
$e->getCode(),
$this->l10n->t('%s', [$e->getMessage()])
);
} catch (StorageNotAvailableException $e) {
$storage->setStatus(
\OC_Mount_Config::STATUS_ERROR,
$e->getCode(),
$this->l10n->t('%s', [$e->getMessage()])
);
} catch (\Exception $e) {

View File

@ -37,8 +37,8 @@ class ExtStorageAuthException extends StorageNotAvailableException {
* @param \Exception $previous
* @since 9.0.0
*/
public function __construct($message = '', $code, \Exception $previous = null) {
public function __construct($message = '', \Exception $previous = null) {
$l = \OC::$server->getL10N('core');
parent::__construct($message, $l->t('External storage unauthorized'), 3, $previous);
parent::__construct($l->t('External storage unauthorized. %s', $message), self::STATUS_UNAUTHORIZED, $previous);
}
}

View File

@ -37,9 +37,9 @@ class ExtStorageBadConfigException extends StorageNotAvailableException {
* @param \Exception $previous
* @since 9.0.0
*/
public function __construct($message = '', $code, \Exception $previous = null) {
public function __construct($message = '', \Exception $previous = null) {
$l = \OC::$server->getL10N('core');
parent::__construct($message, $l->t('External storage incomplete configuration'), 2, $previous);
parent::__construct($l->t('External storage incomplete configuration. %s', $message), self::STATUS_INCOMPLETE_CONF, $previous);
}
}

View File

@ -37,8 +37,8 @@ class ExtStorageConnectionException extends StorageNotAvailableException {
* @param \Exception $previous
* @since 9.0.0
*/
public function __construct($message = '', $code, \Exception $previous = null) {
public function __construct($message = '', \Exception $previous = null) {
$l = \OC::$server->getL10N('core');
parent::__construct($message, $l->t('External storage connection error'), 5, $previous);
parent::__construct($l->t('External storage connection error. %s', $message), self::STATUS_NETWORK_ERROR, $previous);
}
}

View File

@ -37,8 +37,8 @@ class ExtStorageTimeoutException extends StorageNotAvailableException {
* @param \Exception $previous
* @since 9.0.0
*/
public function __construct($message = '', $code, \Exception $previous = null) {
public function __construct($message = '', \Exception $previous = null) {
$l = \OC::$server->getL10N('core');
parent::__construct($message, $l->t('External storage connection timeout'), 4, $previous);
parent::__construct($l->t('External storage connection timeout. %s', $message), self::STATUS_TIMEOUT, $previous);
}
}

View File

@ -37,6 +37,11 @@ use OC\HintException;
*/
class StorageNotAvailableException extends HintException {
const STATUS_INCOMPLETE_CONF = 3;
const STATUS_UNAUTHORIZED = 4;
const STATUS_TIMEOUT = 5;
const STATUS_NETWORK_ERROR = 6;
/**
* StorageNotAvailableException constructor.
*