Skip to content

pydantic_graph.exceptions

GraphSetupError

Bases: TypeError

Error caused by an incorrectly configured graph.

Source code in pydantic_graph/pydantic_graph/exceptions.py
 7  8  9 10 11 12 13 14 15
class GraphSetupError(TypeError):  """Error caused by an incorrectly configured graph.""" message: str  """Description of the mistake.""" def __init__(self, message: str): self.message = message super().__init__(message) 

message instance-attribute

message: str = message 

Description of the mistake.

GraphBuildingError

Bases: ValueError

An error raised during graph-building.

Source code in pydantic_graph/pydantic_graph/exceptions.py
18 19 20 21 22 23 24 25 26
class GraphBuildingError(ValueError):  """An error raised during graph-building.""" message: str  """The error message.""" def __init__(self, message: str): self.message = message super().__init__(message) 

message instance-attribute

message: str = message 

The error message.

GraphValidationError

Bases: ValueError

An error raised during graph validation.

Source code in pydantic_graph/pydantic_graph/exceptions.py
29 30 31 32 33 34 35 36 37
class GraphValidationError(ValueError):  """An error raised during graph validation.""" message: str  """The error message.""" def __init__(self, message: str): self.message = message super().__init__(message) 

message instance-attribute

message: str = message 

The error message.

GraphRuntimeError

Bases: RuntimeError

Error caused by an issue during graph execution.

Source code in pydantic_graph/pydantic_graph/exceptions.py
40 41 42 43 44 45 46 47 48
class GraphRuntimeError(RuntimeError):  """Error caused by an issue during graph execution.""" message: str  """The error message.""" def __init__(self, message: str): self.message = message super().__init__(message) 

message instance-attribute

message: str = message 

The error message.

GraphNodeStatusError

Bases: GraphRuntimeError

Error caused by trying to run a node that already has status 'running', 'success', or 'error'.

Source code in pydantic_graph/pydantic_graph/exceptions.py
51 52 53 54 55 56 57 58 59 60 61 62
class GraphNodeStatusError(GraphRuntimeError):  """Error caused by trying to run a node that already has status `'running'`, `'success'`, or `'error'`.""" def __init__(self, actual_status: 'SnapshotStatus'): self.actual_status = actual_status super().__init__(f"Incorrect snapshot status {actual_status!r}, must be 'created' or 'pending'.") @classmethod def check(cls, status: 'SnapshotStatus') -> None:  """Check if the status is valid.""" if status not in {'created', 'pending'}: raise cls(status) 

check classmethod

check(status: SnapshotStatus) -> None 

Check if the status is valid.

Source code in pydantic_graph/pydantic_graph/exceptions.py
58 59 60 61 62
@classmethod def check(cls, status: 'SnapshotStatus') -> None:  """Check if the status is valid.""" if status not in {'created', 'pending'}: raise cls(status)