StackExceptionInterpreter
QuantConnect.Exceptions.StackExceptionInterpreter
StackExceptionInterpreter(
interpreters: List[IExceptionInterpreter],
)
Bases: Object, IExceptionInterpreter
Interprets exceptions using the configured interpretations
Initializes a new instance of the StackExceptionInterpreter class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interpreters
|
List[IExceptionInterpreter]
|
The interpreters to use |
required |
order
order: int
Determines the order that an instance of this class should be called
interpreters
interpreters: Iterable[IExceptionInterpreter]
Gets the interpreters loaded into this instance
can_interpret
can_interpret(exception: Exception) -> bool
Determines if this interpreter should be applied to the specified exception.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception
|
Exception
|
The exception to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the exception can be interpreted, false otherwise. |
create_from_assemblies
create_from_assemblies() -> StackExceptionInterpreter
Creates a new StackExceptionInterpreter by loading implementations with default constructors from the specified assemblies
Returns:
| Type | Description |
|---|---|
StackExceptionInterpreter
|
A new StackExceptionInterpreter containing interpreters from the specified assemblies. |
get_exception_message_header
get_exception_message_header(exception: Exception) -> str
Combines the exception messages from this exception and all inner exceptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception
|
Exception
|
The exception to create a collated message from |
required |
Returns:
| Type | Description |
|---|---|
str
|
The collate exception message. |
interpret
interpret(
exception: Exception,
inner_interpreter: IExceptionInterpreter = None,
) -> Exception
Interprets the specified exception into a new exception
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception
|
Exception
|
The exception to be interpreted |
required |
inner_interpreter
|
IExceptionInterpreter
|
An interpreter that should be applied to the inner exception. This provides a link back allowing the inner exceptions to be interpreted using the intepretators configured in the StackExceptionInterpreter. Individual implementations may ignore this value if required. |
None
|
Returns:
| Type | Description |
|---|---|
Exception
|
The interpreted exception. |