Coverage for src/arraybridge/exceptions.py: 100%
8 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-03 05:09 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-03 05:09 +0000
1"""Exceptions for arraybridge."""
4class MemoryConversionError(Exception):
5 """
6 Exception raised when memory conversion fails.
8 Attributes:
9 source_type: The source memory type
10 target_type: The target memory type
11 method: The conversion method that was attempted
12 reason: The reason for the failure
13 """
15 def __init__(self, source_type: str, target_type: str, method: str, reason: str):
16 self.source_type = source_type
17 self.target_type = target_type
18 self.method = method
19 self.reason = reason
21 message = (
22 f"Cannot convert from {source_type} to {target_type} using {method}. "
23 f"Reason: {reason}"
24 )
26 super().__init__(message)