Not Callable Predicate Error¶
not_callable_predicate_error
¶
NotCallablePredicateError module.
Defines the NotCallablePredicateError exception that is raised when a specification
predicate is not callable. This error is typically raised by ExpressionSpecification
when an invalid predicate is provided during initialization.
NotCallablePredicateError
¶
Bases: Error[MetadataType]
Exception raised when a specification predicate is not callable.
This error is raised by ExpressionSpecification when the provided predicate
argument is not a callable object. The error message includes the actual type
of the predicate that was provided, helping developers identify and fix the issue.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
ErrorMessage
|
Structured error message containing the type name of the invalid predicate. |
metadata |
ErrorMetadata[MetadataType]
|
Optional metadata providing additional context about the error. |
context |
MetadataType
|
Shortcut access to the metadata context dictionary. |
Example
from forging_blocks.foundation.specification import ExpressionSpecification
spec = ExpressionSpecification(123) # Not callable
Traceback (most recent call last):
...
NotCallablePredicateError: predicate must be Callable and not int
Source code in src/forging_blocks/foundation/errors/not_callable_predicate_error.py
__init__(predicate: object) -> None
¶
Initialize the NotCallablePredicateError with the invalid predicate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predicate
|
object
|
The object that was provided as a predicate but is not callable. |
required |