errors
¶
This module contains the exceptions raised by the package.
Data¶
-
UNDEFINED
= UNDEFINED¶ A sentinel value to specify that something is undefined. When evaluated, the value is falsy.
New in version 2.0.0.
Exceptions¶
-
exception
AttributeResolutionError
(attribute_name, object_, thing=UNDEFINED, suggestion=None)[source]¶ Bases:
rule_engine.errors.EvaluationError
An error raised with an attribute can not be resolved to a value.
New in version 2.0.0.
-
__init__
(attribute_name, object_, thing=UNDEFINED, suggestion=None)[source]¶ - Parameters
Changed in version 3.2.0: Added the suggestion parameter.
-
attribute_name
¶ The name of the symbol that can not be resolved.
-
object
¶ The value that attribute_name was used as an attribute for.
-
suggestion
¶ An optional suggestion for a valid attribute name.
-
thing
¶ The root-object that was used to resolve object.
-
-
exception
AttributeTypeError
(attribute_name, object_type, is_value, is_type, expected_type)[source]¶ Bases:
rule_engine.errors.EvaluationError
An error raised when an attribute with type information is resolved to a Python value that is not of that type.
-
__init__
(attribute_name, object_type, is_value, is_type, expected_type)[source]¶ - Parameters
attribute_name (str) – The name of the symbol that can not be resolved.
object_type – The value that attribute_name was used as an attribute for.
is_value – The native Python value of the incompatible attribute.
is_type – The
rule-engine type
of the incompatible attribute.expected_type – The
rule-engine type
that was expected for this attribute.
-
attribute_name
¶ The name of the attribute that is of an incompatible type.
-
expected_type
¶ The
rule-engine type
that was expected for this attribute.
-
is_type
¶ The
rule-engine type
of the incompatible attribute.
-
is_value
¶ The native Python value of the incompatible attribute.
-
object_type
¶ The object on which the attribute was resolved.
-
-
exception
DatetimeSyntaxError
(message, value)[source]¶ Bases:
rule_engine.errors.SyntaxError
An error raised for issues regarding the use of improperly formatted datetime expressions.
-
value
¶ The datetime value which contains the syntax error which caused this exception to be raised.
-
-
exception
EngineError
(message='')[source]¶ Bases:
Exception
The base exception class from which other exceptions within this package inherit.
-
message
¶ A text description of what error occurred.
-
-
exception
EvaluationError
(message='')[source]¶ Bases:
rule_engine.errors.EngineError
An error raised for issues which occur while the rule is being evaluated. This can occur at parse time while AST nodes are being evaluated during the reduction phase.
-
exception
LookupError
(container, item)[source]¶ Bases:
rule_engine.errors.EvaluationError
An error raised when a lookup operation fails to obtain and item from a container. This is analogous to a combination of Python’s builtin
IndexError
andKeyError
exceptions.New in version 2.4.0.
-
__init__
(container, item)[source]¶ - Parameters
container – The container object that the lookup was performed on.
item – The item that was used as either the key or index of container for the lookup.
-
container
¶ The container object that the lookup was performed on.
-
item
¶ The item that was used as either the key or index of container for the lookup.
-
-
exception
RegexSyntaxError
(message, error, value)[source]¶ Bases:
rule_engine.errors.SyntaxError
An error raised for issues regarding the use of improper regular expression syntax.
-
value
¶ The regular expression value which contains the syntax error which caused this exception to be raised.
-
-
exception
RuleSyntaxError
(message, token=None)[source]¶ Bases:
rule_engine.errors.SyntaxError
An error raised for issues identified in while parsing the grammar of the rule text.
-
__init__
(message, token=None)[source]¶ - Parameters
message (str) – A text description of what error occurred.
token – The PLY token (if available) which is related to the syntax error.
-
token
¶ The PLY token (if available) which is related to the syntax error.
-
-
exception
SymbolResolutionError
(symbol_name, symbol_scope=None, thing=UNDEFINED, suggestion=None)[source]¶ Bases:
rule_engine.errors.EvaluationError
An error raised when a symbol name is not able to be resolved to a value.
-
__init__
(symbol_name, symbol_scope=None, thing=UNDEFINED, suggestion=None)[source]¶ - Parameters
Changed in version 2.0.0: Added the thing parameter.
Changed in version 3.2.0: Added the suggestion parameter.
-
suggestion
¶ An optional suggestion for a valid symbol name.
-
symbol_name
¶ The name of the symbol that can not be resolved.
-
symbol_scope
¶ The scope of where the symbol should be valid for resolution.
-
thing
¶ The root-object that was used to resolve the symbol.
-
-
exception
SymbolTypeError
(symbol_name, is_value, is_type, expected_type)[source]¶ Bases:
rule_engine.errors.EvaluationError
An error raised when a symbol with type information is resolved to a Python value that is not of that type.
-
__init__
(symbol_name, is_value, is_type, expected_type)[source]¶ - Parameters
symbol_name (str) – The name of the symbol that is of an incompatible type.
is_value – The native Python value of the incompatible symbol.
is_type – The
rule-engine type
of the incompatible symbol.expected_type – The
rule-engine type
that was expected for this symbol.
-
expected_type
¶ The
rule-engine type
that was expected for this symbol.
-
is_type
¶ The
rule-engine type
of the incompatible symbol.
-
is_value
¶ The native Python value of the incompatible symbol.
-
symbol_name
¶ The name of the symbol that is of an incompatible type.
-
-
exception
SyntaxError
(message='')[source]¶ Bases:
rule_engine.errors.EngineError
A base error for syntax related issues.
Exception Hierarchy¶
The class hierarchy for Rule Engine exceptions is:
EngineError
+-- EvaluationError
+-- AttributeResolutionError
+-- AttributeTypeError
+-- LookupError
+-- SymbolResolutionError
+-- SymbolTypeError
+-- SyntaxError
+-- DatetimeSyntaxError
+-- RegexSyntaxError
+-- RuleSyntaxError