Use RuntimeError instead of ValueError when the retrieval of default modules fails

This will result in the error actually being in the state reason
of the failed module build instead of "An unknown error occurred
while validating the modulemd".
This commit is contained in:
mprahl
2019-11-01 14:49:10 -04:00
parent 1c645f5a04
commit f95b665904
2 changed files with 3 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ def _get_default_modules(stream, default_modules_scm_url):
:return: a dictionary where the keys are default module names and the values are default module
streams
:rtype: dict
:raise ValueError: if no default modules can be retrieved for that stream
:raise RuntimeError: if no default modules can be retrieved for that stream
"""
scm_obj = scm.SCM(default_modules_scm_url)
temp_dir = tempfile.mkdtemp()
@@ -167,7 +167,7 @@ def _get_default_modules(stream, default_modules_scm_url):
except: # noqa: E722
msg = "Failed to retrieve the default modules"
log.exception(msg)
raise ValueError(msg)
raise RuntimeError(msg)
finally:
shutil.rmtree(temp_dir)

View File

@@ -183,7 +183,7 @@ def test_get_default_modules_invalid_branch(
else:
mock_get_rawhide.return_value = "something_else"
with pytest.raises(ValueError, match="Failed to retrieve the default modules"):
with pytest.raises(RuntimeError, match="Failed to retrieve the default modules"):
default_modules._get_default_modules("f32", conf.default_modules_scm_url)
mock_mmd_new.assert_not_called()