diff --git a/qualibrate/qualibration_graph.py b/qualibrate/qualibration_graph.py index 0c9df9f..7aee33f 100644 --- a/qualibrate/qualibration_graph.py +++ b/qualibrate/qualibration_graph.py @@ -131,7 +131,15 @@ def scan_folder_for_instances( for file in sorted(path.iterdir()): if not file_is_calibration_instance(file, cls.__name__): continue - cls.scan_graph_file(file, graphs) + try: + cls.scan_graph_file(file, graphs) + except Exception as e: + warnings.warn( + RuntimeWarning( + "An error occurred on scanning graph file " + f"{file.name}.\nError message: {e}" + ) + ) finally: cls.mode.inspection = inspection return graphs @@ -188,9 +196,11 @@ def completed_count(self) -> int: ) def _get_all_nodes_parameters( - self, nodes_parameters: Mapping[str, Any] + self, nodes_parameters: Mapping[str, Any] ) -> Mapping[str, Any]: - nodes_class = self.full_parameters_class.model_fields["nodes"].annotation + nodes_class = self.full_parameters_class.model_fields[ + "nodes" + ].annotation return { name: nodes_parameters.get(name, {}) for name in cast(NodesParameters, nodes_class).model_fields.keys() diff --git a/qualibrate/qualibration_node.py b/qualibrate/qualibration_node.py index ce7a5a0..3fac7ae 100644 --- a/qualibrate/qualibration_node.py +++ b/qualibrate/qualibration_node.py @@ -301,7 +301,16 @@ def scan_folder_for_instances( for file in sorted(path.iterdir()): if not file_is_calibration_instance(file, cls.__name__): continue - cls.scan_node_file(file, nodes) + try: + cls.scan_node_file(file, nodes) + except Exception as e: + warnings.warn( + RuntimeWarning( + "An error occurred on scanning node file " + f"{file.name}.\nError: {type(e)}: {e}" + ) + ) + finally: cls.mode.inspection = inspection return nodes