[core] Add 'strictCompatibility' mode for loadGraph function

Provide a way to control how to handle node compatibility issues
when loading a Graph with the `strictCompatibility` parameter.
Introduce a new error type, GraphCompatibilityError, to be raised
when loading a Graph with compatibility issues with strictCompatibility enabled.
This commit is contained in:
Yann Lanthony 2024-11-14 19:11:08 +01:00
parent c3bb55a414
commit c09a0d2327
2 changed files with 33 additions and 2 deletions

View file

@ -12,6 +12,21 @@ class GraphException(MeshroomException):
pass
class GraphCompatibilityError(GraphException):
"""
Raised when node compatibility issues occur when loading a graph.
Args:
filepath: The path to the file that caused the error.
issues: A dictionnary of node names and their respective compatibility issues.
"""
def __init__(self, filepath, issues: dict[str, str]) -> None:
self.filepath = filepath
self.issues = issues
msg = f"Compatibility issues found when loading {self.filepath}: {self.issues}"
super().__init__(msg)
class UnknownNodeTypeError(GraphException):
"""
Raised when asked to create a unknown node type.