errors

This module contains the exceptions raised by the package.

Exceptions

exception DatetimeSyntaxError(message, value)[source]

Bases: rule_engine.errors.SyntaxError

An error raised for issues regarding the use of improperly formatted datetime expressions.

__init__(message, value)[source]
Parameters

message (str) – A text description of what error occurred.

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.

__init__(message='')[source]
Parameters

message (str) – A text description of what error occurred.

message

The message describing the error that 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 RegexSyntaxError(message, error)[source]

Bases: rule_engine.errors.SyntaxError

An error raised for issues regarding the use of improper regular expression syntax.

__init__(message, error)[source]
Parameters

message (str) – A text description of what error occurred.

error

The re.error exception from which this error was triggered.

property 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.

exception SymbolResolutionError(symbol_name, symbol_scope=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)[source]
Parameters
  • symbol_name (str) – The name of the symbol that can not be resolved.

  • symbol_scope (str) – The scope of where the symbol should be valid for resolution.

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.

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

message (str) – A text description of what error occurred.

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.