From 7f37d4fa4cf7bb95f53965e31f76026c6786771b Mon Sep 17 00:00:00 2001 From: Mark Final Date: Thu, 13 Jul 2023 20:47:10 +0100 Subject: [PATCH] Fixes #83. Parsing an invalid conandata.yml now shows the exception message to the user --- cruiz/commands/context.py | 2 +- cruiz/load_recipe/loadrecipewizard.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cruiz/commands/context.py b/cruiz/commands/context.py index f72c05e..f8654e9 100755 --- a/cruiz/commands/context.py +++ b/cruiz/commands/context.py @@ -602,7 +602,7 @@ def get_conandata( if self.parent(): self.parent().record_exception(exception) else: - raise Exception( + raise ValueError( "Failed to get conandata YAML dict for recipe" ) from exception return conandata diff --git a/cruiz/load_recipe/loadrecipewizard.py b/cruiz/load_recipe/loadrecipewizard.py index 14c81f1..57652a9 100644 --- a/cruiz/load_recipe/loadrecipewizard.py +++ b/cruiz/load_recipe/loadrecipewizard.py @@ -67,7 +67,12 @@ def __init__( log_details.logging.connect(self._on_error_loading) with managed_conan_context(DEFAULT_CACHE_NAME, log_details) as context: self.recipe_attributes = context.inspect_recipe(self._path) - self.conandata = context.get_conandata(self._path) + try: + self.conandata = context.get_conandata(self._path) + except ValueError: + log_details.stderr( + "Unable to obtain version numbers from conandata.yml" + ) def _on_error_loading(self) -> None: self.ui.intro_message.show()