Index
pyvider.cty.exceptions
¶
TODO: Add module docstring.
Classes¶
AttributePathError
¶
Bases: CtyError
Raised when there's an error with an attribute path.
This exception occurs when a path operation fails, such as: - When a path cannot be applied to a value - When a path step refers to a non-existent attribute or index - When a path operation is applied to an incompatible value type
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
path |
The path that caused the error |
|
value |
The value the path was being applied to |
Initializes the AttributePathError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
path
|
object
|
The CtyPath or path representation that caused the error. |
None
|
value
|
object
|
The CtyValue to which the path was being applied. |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
CtyCollectionValidationError
¶
CtyCollectionValidationError(
message: str,
value: object = None,
type_name: str | None = None,
path: CtyPath | None = None,
**kwargs: Any
)
Bases: CtyValidationError
Base for collection-related validation errors.
Source code in pyvider/cty/exceptions/validation.py
CtyConversionError
¶
CtyConversionError(
message: str,
*,
source_value: object | None = None,
target_type: object | None = None,
**kwargs: Any
)
Bases: CtyError
Base for CTY value or type conversion errors.
Initializes the CtyConversionError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
source_value
|
object | None
|
The value that was being converted. |
None
|
target_type
|
object | None
|
The intended target type of the conversion. |
None
|
**kwargs
|
Any
|
Additional foundation error context. |
{}
|
Source code in pyvider/cty/exceptions/conversion.py
Functions¶
CtyError
¶
Bases: FoundationError
Base exception for all pyvider.cty errors.
This is the root exception for all errors that occur within the cty type system. It provides a foundation for more specific error types and can be used to catch any cty-related error.
Now inherits from FoundationError to provide rich context support, telemetry integration, and enhanced diagnostics.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
Source code in pyvider/cty/exceptions/base.py
CtyFunctionError
¶
CtyFunctionError(
message: str = "An error occurred during CTY function execution",
*,
function_name: str | None = None,
input_types: list[str] | None = None,
**kwargs: Any
)
Bases: CtyError
Exception raised for errors during the execution of a CTY standard library function.
Enhanced with rich context support for function name, arguments, and execution details.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
function_name |
Name of the CTY function that failed |
Source code in pyvider/cty/exceptions/base.py
CtyTypeConversionError
¶
CtyTypeConversionError(
message: str,
*,
type_name: str | None = None,
source_value: object | None = None,
target_type: object | None = None,
**kwargs: Any
)
Bases: CtyConversionError
CTY type representation conversion failure.
Initializes the CtyTypeConversionError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
type_name
|
str | None
|
The name of the CTY type involved in the conversion failure. |
None
|
source_value
|
object | None
|
The value that was being converted. |
None
|
target_type
|
object | None
|
The intended target type of the conversion. |
None
|
Source code in pyvider/cty/exceptions/conversion.py
Functions¶
CtyTypeParseError
¶
Bases: CtyConversionError
Raised when a CTY type string cannot be parsed.
Source code in pyvider/cty/exceptions/conversion.py
CtyValidationError
¶
CtyValidationError(
message: str,
value: object = None,
type_name: str | None = None,
path: CtyPath | None = None,
**kwargs: Any
)
Bases: ValidationError
Base exception for all validation errors.
Inherits from foundation's ValidationError for enhanced diagnostics and automatic retry/circuit breaker support where applicable.
Source code in pyvider/cty/exceptions/validation.py
DeserializationError
¶
DeserializationError(
message: str,
data: object = None,
format_name: str | None = None,
**kwargs: Any
)
Bases: EncodingError
Raised when deserialization of data fails.
This exception occurs when serialized data cannot be converted back into a Cty value, such as when the data is corrupt or in an incompatible format.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
data |
The data that failed to deserialize |
|
format_name |
The name of the format that was being used |
Initializes the DeserializationError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
data
|
object
|
The data that failed to deserialize. |
None
|
format_name
|
str | None
|
The name of the deserialization format. |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
DynamicValueError
¶
Bases: SerializationError
Raised when there's an error encoding or decoding a DynamicValue.
This exception is specific to the handling of dynamic values in serialization contexts, where type information might be unknown or ambiguous.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
value |
The dynamic value that caused the error |
Initializes the DynamicValueError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
value
|
object
|
The dynamic value that caused the error. |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
EncodingError
¶
Bases: CtyError
Base exception for all encoding/serialization errors.
This exception serves as the parent class for more specific errors related to serialization and deserialization of Cty values.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
data |
The data that caused the encoding error |
|
encoding |
The name of the encoding format that was being used |
Initializes the EncodingError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
data
|
object
|
The data that was being encoded/decoded when the error occurred. |
None
|
encoding
|
str | None
|
The name of the encoding format (e.g., "json", "msgpack"). |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
InvalidTypeError
¶
Bases: CtyError
Raised when an invalid type is used in a type definition.
This exception occurs when attempting to create a type with invalid parameters or constraints, such as using a non-CtyType instance when a CtyType is required.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
invalid_type |
The invalid type that caused the error |
Initializes the InvalidTypeError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
invalid_type
|
object
|
The type object that was found to be invalid. |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
JsonEncodingError
¶
Bases: EncodingError
Raised when JSON encoding or decoding fails.
This exception provides specific context for JSON serialization errors, including details about the specific JSON operation that failed.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
data |
The data that caused the encoding error |
|
operation |
The operation that failed (encode/decode) |
Initializes the JsonEncodingError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
data
|
object
|
The data involved in the JSON operation. |
None
|
operation
|
str | None
|
The JSON operation that failed (e.g., "encode", "decode"). |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
MsgPackEncodingError
¶
Bases: EncodingError
Raised when MessagePack encoding or decoding fails.
This exception provides specific context for MessagePack serialization errors, including details about the specific MessagePack operation that failed.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
data |
The data that caused the encoding error |
|
operation |
The operation that failed (encode/decode) |
Initializes the MsgPackEncodingError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
data
|
object
|
The data involved in the MessagePack operation. |
None
|
operation
|
str | None
|
The MessagePack operation that failed (e.g., "encode", "decode"). |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
SerializationError
¶
SerializationError(
message: str,
value: object = None,
format_name: str | None = None,
**kwargs: Any
)
Bases: EncodingError
Raised when serialization of a value fails.
This exception occurs when a Cty value cannot be serialized to a particular format, such as when a value contains types that aren't supported by the serialization format.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
value |
The value that failed to serialize |
|
format_name |
The name of the format that was being used |
Initializes the SerializationError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
value
|
object
|
The value that failed to serialize. |
None
|
format_name
|
str | None
|
The name of the serialization format. |
None
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
TransformationError
¶
TransformationError(
message: str,
schema: object = None,
target_type: object = None,
**kwargs: object
)
Bases: CtyError
Raised when a schema transformation fails.
This exception occurs when a schema cannot be transformed from one representation to another, such as during conversion between different schema formats or when applying schema transformations.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
schema |
The schema that failed transformation |
|
target_type |
The intended target type of a transformation, if applicable |
Initializes the TransformationError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
schema
|
object
|
The schema object that was being transformed. |
None
|
target_type
|
object
|
The intended target type of the transformation. |
None
|
**kwargs
|
object
|
Additional keyword arguments for foundation error context. |
{}
|
Source code in pyvider/cty/exceptions/encoding.py
Functions¶
WireFormatError
¶
WireFormatError(
message: str,
*,
format_type: object = None,
operation: str | None = None,
**kwargs: object
)
Bases: TransformationError
Raised when wire format encoding or decoding fails.
This exception is specific to the wire format system and provides additional context about the operation that failed.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
A human-readable error description |
|
format_type |
The wire format type that encountered an error |
|
operation |
The operation that failed (marshal/unmarshal) |
Initializes the WireFormatError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
format_type
|
object
|
The wire format type that encountered the error. |
None
|
operation
|
str | None
|
The wire format operation that failed (e.g., "marshal", "unmarshal"). |
None
|
**kwargs
|
object
|
Additional arguments for the parent TransformationError. |
{}
|