Skip to content

Commit

Permalink
Remove StratisCliAggregateError
Browse files Browse the repository at this point in the history
It was only used in the global unlock method, which has been removed.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Jun 13, 2022
1 parent d285964 commit ab9db80
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 48 deletions.
7 changes: 0 additions & 7 deletions src/stratis_cli/_error_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from ._actions import BLOCKDEV_INTERFACE, FILESYSTEM_INTERFACE, POOL_INTERFACE
from ._errors import (
StratisCliActionError,
StratisCliAggregateError,
StratisCliEngineError,
StratisCliIncoherenceError,
StratisCliParserError,
Expand Down Expand Up @@ -205,12 +204,6 @@ def _interpret_errors_1(
if isinstance(error, StratisCliUserError):
return f"It appears that you issued an unintended command: {error}"

# The only situation in which an AggregateError can be raised is if there
# is a problem activating devcies, but the sim engine does not simulate
# activation of locked devices.
if isinstance(error, StratisCliAggregateError): # pragma: no cover
return f"An iterative command generated one or more errors: {error}"

if isinstance(error, StratisCliStratisdVersionError):
return (
f"{error}. stratis can execute only the subset of its "
Expand Down
29 changes: 0 additions & 29 deletions src/stratis_cli/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
Error heirarchy for stratis cli.
"""

# isort: STDLIB
import os

from ._stratisd_constants import (
BLOCK_DEV_TIER_TO_NAME,
STRATISD_ERROR_TO_NAME,
Expand Down Expand Up @@ -428,32 +425,6 @@ def __str__(self):
)


class StratisCliAggregateError(StratisCliRuntimeError):
"""
Raised when multiple errors have occured in a looping operation.
"""

def __init__(self, operation, type_, errors):
"""
Initializer.
:param str operation: the looping operation that failed.
:param str type_: the type of the resource for which the operation failed.
:param errors: list of all errors that occurred during the looping operation.
:type errors: list of Exception
"""
# pylint: disable=super-init-not-called
self.operation = operation
self.type = type_
self.errors = errors

def __str__(self):
return (
f"The operation '{self.operation}' on a resource of type {self.type} failed. "
f"The following errors occurred:\n"
f"{os.linesep.join([str(error) for error in self.errors])}"
)


class StratisCliPartialFailureError(StratisCliRuntimeError):
"""
A non-fatal error to be reported at the end as part of a StratisCliAggregateError.
Expand Down
12 changes: 0 additions & 12 deletions tests/whitebox/unittest/test_error_fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

# isort: LOCAL
from stratis_cli._errors import (
StratisCliAggregateError,
StratisCliEngineError,
StratisCliGenerationError,
StratisCliIncoherenceError,
StratisCliPartialFailureError,
Expand Down Expand Up @@ -59,16 +57,6 @@ def test_stratis_cli_generation_error_fmt(self):
"""
self._string_not_empty(StratisCliGenerationError("Error"))

def test_stratis_cli_aggregate_error_fmt(self):
"""
Test 'StratisCliAggregateError'
"""
self._string_not_empty(
StratisCliAggregateError(
"do lots of things", "toy", [StratisCliEngineError(1, "bad")]
)
)

def test_stratis_cli_partial_failure_error(self):
"""
Test 'StratisCliPartialFailureError'
Expand Down

0 comments on commit ab9db80

Please sign in to comment.