Files

91 lines
2.2 KiB
Python
Raw Permalink Normal View History

class WorkflowError(Exception):
"""
Exception indicating an error that the current loop cannot handle, preventing further progress.
"""
class LLMUnavailableError(RuntimeError):
"""
Raised when the LLM backend fails to respond after all retries.
Registered as skip_loop_error in QuantRDLoop so a transient LLM outage
skips the current loop iteration instead of killing the whole process.
"""
class FormatError(WorkflowError):
"""
After multiple attempts, we are unable to obtain the answer in the correct format to proceed.
"""
2026-03-02 19:04:10 +08:00
class CodeBlockParseError(FormatError):
"""Raised when code block extraction fails after all strategies."""
def __init__(self, message: str, content: str, language: str) -> None:
self.message = message
self.content = content
self.language = language
super().__init__(message)
class CoderError(WorkflowError):
2024-05-21 22:48:41 +08:00
"""
Exceptions raised when Implementing and running code.
2024-07-05 17:42:00 +08:00
- start: FactorTask => FactorGenerator
2024-05-21 22:48:41 +08:00
- end: Get dataframe after execution
The more detailed evaluation in dataframe values are managed by the evaluator.
"""
# NOTE: it corresponds to the error of **component**
caused_by_timeout: bool = False # whether the error is caused by timeout
2024-05-21 22:48:41 +08:00
2024-07-18 22:36:04 +08:00
class CodeFormatError(CoderError):
2024-05-21 22:48:41 +08:00
"""
The generated code is not found due format error.
"""
2024-07-18 22:36:04 +08:00
class CustomRuntimeError(CoderError):
2024-05-21 22:48:41 +08:00
"""
The generated code fail to execute the script.
"""
2024-07-18 22:36:04 +08:00
class NoOutputError(CoderError):
2024-05-21 22:48:41 +08:00
"""
The code fail to generate output file.
"""
2024-07-17 15:00:13 +08:00
class RunnerError(Exception):
2024-07-17 15:00:13 +08:00
"""
Exceptions raised when running the code output.
"""
# NOTE: it corresponds to the error of whole **project**
2024-07-17 15:00:13 +08:00
2025-02-25 12:06:07 +08:00
FactorEmptyError = CoderError # Exceptions raised when no factor is generated correctly
2024-07-17 15:00:13 +08:00
2025-02-25 12:06:07 +08:00
ModelEmptyError = CoderError # Exceptions raised when no model is generated correctly
2024-11-04 14:57:10 +08:00
class KaggleError(Exception):
"""
Exceptions raised when calling Kaggle API
"""
2025-05-29 17:23:06 +08:00
class PolicyError(Exception):
"""
Exceptions raised due to content management policy
"""
2026-03-02 19:04:10 +08:00
class EvaluatorDidNotTerminateError(RuntimeError):
"""
Evaluator generator did not terminate with a final Feedback.
"""