Fix code from PR comments
This commit is contained in:
parent
9d1ec02c5a
commit
4ead2bc861
6 changed files with 14 additions and 29 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue