Skip to content

Commit

Permalink
Merge pull request #705 from intuitem/extra_log_mapping
Browse files Browse the repository at this point in the history
Add extra log useful for mapping issues
  • Loading branch information
eric-intuitem authored Aug 5, 2024
2 parents 6d8369c + f497005 commit a69b95e
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions backend/library/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,17 @@ def load(
urn=self.data["target_requirement_urn"], default_locale=True
)
except RequirementNode.DoesNotExist:
raise Http404(
"ERROR: target requirement with URN {} does not exist".format(
self.data["target_requirement_urn"]
)
)

err_msg = f"ERROR: target requirement with URN {self.data['target_requirement_urn']} does not exist"
print(err_msg)
raise Http404(err_msg)
try:
source_requirement = RequirementNode.objects.get(
urn=self.data["source_requirement_urn"], default_locale=True
)
except RequirementNode.DoesNotExist:
raise Http404(
"ERROR: source requirement with URN {} does not exist".format(
self.data["source_requirement"]
)
)
err_msg = f"ERROR: source requirement with URN {self.data['source_requirement_urn']} does not exist"
print(err_msg)
raise Http404(err_msg)
return RequirementMapping.objects.create(
mapping_set=mapping_set,
target_requirement=target_requirement,
Expand Down Expand Up @@ -581,7 +576,6 @@ def init(self) -> Union[str, None]:

def check_and_import_dependencies(self):
"""Check and import library dependencies."""

if not self._library.dependencies:
return None
for dependency_urn in self._library.dependencies:
Expand Down Expand Up @@ -660,8 +654,9 @@ def import_library(self):
"""Main method to import a library."""
if (error_message := self.init()) is not None:
return error_message # This error check should be done when storing the Library but no after.

print("::: Getting Dependencies :::")
error_msg = self.check_and_import_dependencies()
print("::: Dependencies are ok :::")
if error_msg is not None:
return error_msg

Expand Down

0 comments on commit a69b95e

Please sign in to comment.