class
AI::Provider::TypeValidationError
- AI::Provider::TypeValidationError
- AI::Provider::AISDKError
- Exception
- Reference
- Object
Overview
Error thrown when type validation fails.
This error provides context about the value that failed validation and the underlying validation error.
Defined in:
ai/provider/errors/type_validation_error.crConstructors
-
.new(*, value, cause : Exception)
Creates a new TypeValidationError.
-
.wrap(*, value, cause : Exception) : TypeValidationError
Wraps an error into a TypeValidationError.
Class Method Summary
-
.instance?(error) : Bool
Checks if the given value is an instance of TypeValidationError.
Instance Method Summary
-
#value : JSON::Any | Nil
The value that failed type validation.
Instance methods inherited from class AI::Provider::AISDKError
name : String
name,
to_s(io : IO) : Nil
to_s
Constructor methods inherited from class AI::Provider::AISDKError
new(*, name : String, message : String, cause : Exception | Nil = nil)
new
Class methods inherited from class AI::Provider::AISDKError
instance?(error) : Bool
instance?
Constructor Detail
def self.new(*, value, cause : Exception)
#
Creates a new TypeValidationError.
Parameters:
- value: The value that failed validation (any type)
- cause: The underlying validation exception
def self.wrap(*, value, cause : Exception) : TypeValidationError
#
Wraps an error into a TypeValidationError.
If the cause is already a TypeValidationError with the same value, it returns the cause. Otherwise, it creates a new TypeValidationError.
Parameters:
- value: The value that failed validation
- cause: The original error or cause of the validation failure
Returns: A TypeValidationError instance
Class Method Detail
Instance Method Detail
def value : JSON::Any | Nil
#
The value that failed type validation. Stored as JSON::Any to handle any type.