Skip to content

Commit c004b57

Browse files
committed
refactor: rename SkipAdd exception -> SkipAddError
Maintains convention and consistency of naming any exceptions with "Error".
1 parent b3e7a30 commit c004b57

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

moe/moe_import/import_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
__all__ = ["candidate_prompt", "import_prompt"]
3232

3333

34-
class AbortImport(Exception): # noqa: N818 breaking change
34+
class AbortImportError(Exception):
3535
"""Used to abort the import process."""
3636

3737

@@ -129,7 +129,7 @@ def process_candidates(new_album: Album, candidates: list[CandidateAlbum]) -> No
129129
max_candidates = config.CONFIG.settings.get("import.max_candidates")
130130
try:
131131
candidate_prompt(new_album, candidates[:max_candidates])
132-
except AbortImport as err:
132+
except AbortImportError as err:
133133
log.debug(err)
134134
raise SystemExit(0) from err
135135

@@ -142,7 +142,7 @@ def candidate_prompt(new_album: Album, candidates: list[CandidateAlbum]) -> None
142142
candidates: List of candidates to choose from.
143143
144144
Raises:
145-
AbortImport: Import prompt was aborted by the user.
145+
AbortImportError: Import prompt was aborted by the user.
146146
"""
147147
prompt_choices: list[PromptChoice] = []
148148

@@ -204,7 +204,7 @@ def import_prompt(
204204
against ``old_album``.
205205
206206
Raises:
207-
AbortImport: Import prompt was aborted by the user.
207+
AbortImportError: Import prompt was aborted by the user.
208208
"""
209209
log.debug(f"Running import prompt. [{new_album=}, {candidate=}]")
210210

@@ -249,7 +249,7 @@ def _abort_changes(
249249
) -> None:
250250
"""Aborts the album changes."""
251251
err_msg = "Import prompt aborted; no changes made."
252-
raise AbortImport(err_msg)
252+
raise AbortImportError(err_msg)
253253

254254

255255
def _fmt_import_updates(new_album: Album, candidate: CandidateAlbum) -> Panel:

tests/import/test_import_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_abort_import(self):
121121
with (
122122
patch(
123123
"moe.moe_import.import_cli.candidate_prompt",
124-
side_effect=moe_import.import_cli.AbortImport,
124+
side_effect=moe_import.import_cli.AbortImportError,
125125
autospec=True,
126126
),
127127
pytest.raises(SystemExit) as error,
@@ -365,7 +365,7 @@ def test_apply_fields(self):
365365
assert extra.path
366366

367367
def test_abort(self):
368-
"""The `abort` prompt choice should raise an AbortImport error."""
368+
"""The `abort` prompt choice should raise an AbortImportError."""
369369
album = album_factory()
370370
candidate = CandidateAlbum(
371371
album=album_factory(),
@@ -383,7 +383,7 @@ def test_abort(self):
383383
return_value=abort_choice,
384384
autospec=True,
385385
),
386-
pytest.raises(moe_import.import_cli.AbortImport),
386+
pytest.raises(moe_import.import_cli.AbortImportError),
387387
):
388388
moe_import.import_cli.import_prompt(album, candidate)
389389

0 commit comments

Comments
 (0)