mbdlyb.exceptions

Custom exception classes for the MBDlyb library.

Provides specialized exception types for various error conditions that can occur during MBD model creation, manipulation, and reasoning.

Exceptions

ElementExistsError

Exception raised when attempting to add a duplicate element to a network.

ElementNotFoundError

Exception raised when attempting to access a non-existent element.

InvalidReasonerError

Exception raised when a reasoner operation cannot be completed.

InvalidRelationError

Exception raised when a relation cannot be created or modified as specified.

InvalidValueError

Exception raised when a value is not valid for a given variable or property.

Module Contents

exception mbdlyb.exceptions.ElementExistsError(fqn: mbdlyb.fqn.FQN, containing_element: mbdlyb.fqn.FQN)

Bases: Exception

Exception raised when attempting to add a duplicate element to a network.

Raised when an attempt is made to create an element with a name that already exists in the same parent network.

exception mbdlyb.exceptions.ElementNotFoundError(fqn: mbdlyb.fqn.FQN, containing_element: mbdlyb.fqn.FQN)

Bases: Exception

Exception raised when attempting to access a non-existent element.

Raised when an attempt is made to retrieve an element that does not exist in the specified network.

exception mbdlyb.exceptions.InvalidReasonerError(message: str)

Bases: RuntimeError

Exception raised when a reasoner operation cannot be completed.

Raised when attempting to use a reasoner in an invalid state, with incompatible settings, or when reasoning fails due to model constraints.

exception mbdlyb.exceptions.InvalidRelationError(msg: str)

Bases: RuntimeError

Exception raised when a relation cannot be created or modified as specified.

Raised when attempting to create a relation that violates constraints, such as insufficient nodes, invalid node types, or rejection by node validation methods.

exception mbdlyb.exceptions.InvalidValueError(message: str, closest_idx: int | None = None)

Bases: ValueError

Exception raised when a value is not valid for a given variable or property.

Raised when attempting to set or use a value that is not in the valid set of states or values for a variable. Optionally stores the index of the closest valid value for error recovery purposes.

closest_idx = None