Skip to content

Commit c8952b3

Browse files
committed
Fix exception usage
1 parent 346f12b commit c8952b3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/manage/install_command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def execute(cmd):
736736
break
737737
except LookupError:
738738
LOGGER.error("Failed to find a suitable install for '%s'.", tag)
739-
raise NoInstallFoundError()
739+
raise NoInstallFoundError(tag)
740740
except Exception as ex:
741741
LOGGER.debug("Capturing error in case fallbacks fail", exc_info=True)
742742
first_exc = first_exc or ex
@@ -798,7 +798,7 @@ def execute(cmd):
798798
break
799799
except LookupError:
800800
LOGGER.error("Failed to find a suitable update for '%s'.", install['id'])
801-
raise NoInstallFoundError()
801+
raise NoInstallFoundError(install.get('tag'))
802802
except Exception as ex:
803803
LOGGER.debug("Capturing error in case fallbacks fail", exc_info=True)
804804
first_exc = first_exc or ex
@@ -834,7 +834,7 @@ def execute(cmd):
834834
break
835835
except LookupError:
836836
LOGGER.error("Failed to find a suitable install for '%s'.", tag)
837-
raise NoInstallFoundError()
837+
raise NoInstallFoundError(tag)
838838
except (AssertionError, AttributeError, TypeError):
839839
# These errors should never happen.
840840
raise

tests/test_install_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import json
22
import os
33
import pytest
4-
import secrets
54
from pathlib import Path, PurePath
65

76
from manage import install_command as IC
87
from manage import installs
8+
from manage.exceptions import NoInstallFoundError
99

1010

1111
def test_print_cli_shortcuts(patched_installs, assert_log, monkeypatch, tmp_path):
@@ -291,7 +291,7 @@ def get_install_to_run(self, tag):
291291
for i in self.installs:
292292
if i["tag"] == tag or f"{i['company']}/{i['tag']}" == tag:
293293
return i
294-
raise LookupError
294+
raise NoInstallFoundError(tag)
295295

296296

297297
def test_install_simple(tmp_path, assert_log):

0 commit comments

Comments
 (0)