From 127e6c1cfdebc9dfacf7739979209fc0ab58bda7 Mon Sep 17 00:00:00 2001 From: ewuerger Date: Wed, 28 Feb 2024 12:56:14 +0100 Subject: [PATCH] refactor: Apply changes from code review --- capella2polarion/converters/element_converter.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/capella2polarion/converters/element_converter.py b/capella2polarion/converters/element_converter.py index 5d5c1067..2fa8b248 100644 --- a/capella2polarion/converters/element_converter.py +++ b/capella2polarion/converters/element_converter.py @@ -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 @@ -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(