Skip to content

Commit

Permalink
refactor: Apply changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Feb 28, 2024
1 parent ce32fad commit 127e6c1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions capella2polarion/converters/element_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ def serialize(self, uuid: str) -> data_models.CapellaWorkItem | None:
except Exception as error:
converter_data.errors.add(error.args[0])
converter_data.work_item = None
return None # Force to not overwrite on failure
assert converter_data.work_item is not None
for finding in converter_data.errors:
logger.warning("Serialization failed: %s (%r).", finding, uuid)

if converter_data.errors:
logger.error(
"Serialization of %r successful, but with warnings: \n\t %s",
converter_data.capella_element._short_repr_(),
"\n\t".join(converter_data.errors),
)
return converter_data.work_item

# General helper functions
Expand Down Expand Up @@ -295,8 +298,7 @@ def repair_images(node: etree._Element) -> None:

except FileNotFoundError:
self.converter_session[obj.uuid].errors.add(
f"Inline image can't be found from {file_path!r} "
f"for {obj._short_repr_()!r}"
f"Inline image can't be found from {file_path!r}."
)

repaired_markup = chelpers.process_html_fragments(
Expand Down

0 comments on commit 127e6c1

Please sign in to comment.