Skip to content
Snippets Groups Projects
Commit 89b01a7e authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

Merge branch 'use-more-specific-exceptions' into 'linux-debian11'

if a file or directory cannot be found use FileNotFoundError

See merge request mpsd-cs/mpsd-software-environments!10
parents b2caebe8 71412d46
No related branches found
No related tags found
2 merge requests!19Move linux-debian11 into main,!10if a file or directory cannot be found use FileNotFoundError
Pipeline #368041 passed
...@@ -173,13 +173,13 @@ def get_release_info(mpsd_release: str, script_dir: Path) -> Tuple[str, str, Lis ...@@ -173,13 +173,13 @@ def get_release_info(mpsd_release: str, script_dir: Path) -> Tuple[str, str, Lis
toolchains for the release. toolchains for the release.
Raises: Raises:
- Exception: If the release directory does not exist. Run `create_dir_structure()` - FileNotFoundError: If the release directory does not exist. Run
first. `create_dir_structure()` first.
""" """
# Get the info for release # Get the info for release
release_base_dir = script_dir / mpsd_release release_base_dir = script_dir / mpsd_release
if not os.path.exists(release_base_dir): if not os.path.exists(release_base_dir):
raise Exception( raise FileNotFoundError(
"Release directory does not exist. Run create_dir_structure() first." "Release directory does not exist. Run create_dir_structure() first."
) )
with os_chdir(release_base_dir): with os_chdir(release_base_dir):
...@@ -254,7 +254,7 @@ def install_environment( ...@@ -254,7 +254,7 @@ def install_environment(
cache when installing toolchains. Defaults to False. cache when installing toolchains. Defaults to False.
Raises: Raises:
Exception: If a requested toolchain is not available in the specified release. ValueError: If a requested toolchain is not available in the specified release.
Returns: Returns:
None None
...@@ -292,7 +292,7 @@ def install_environment( ...@@ -292,7 +292,7 @@ def install_environment(
for toolchain in toolchains: for toolchain in toolchains:
if toolchain not in available_toolchains: if toolchain not in available_toolchains:
raise Exception( raise ValueError(
f"Toolchain '{toolchain}' is not available in release {mpsd_release}." f"Toolchain '{toolchain}' is not available in release {mpsd_release}."
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment