mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-14 02:28:30 +00:00
- Add GuardrailValidationError exception - Use typing.get_type_hints for better type checking - Add descriptive error messages with context - Support dict return type Co-Authored-By: Joe Moura <joao@crewai.com>
26 lines
840 B
Python
26 lines
840 B
Python
"""
|
|
Module for task-related exceptions.
|
|
|
|
This module provides custom exceptions used throughout the task system
|
|
to provide more specific error handling and context.
|
|
"""
|
|
|
|
from typing import Any, Dict, Optional
|
|
|
|
|
|
class GuardrailValidationError(Exception):
|
|
"""Exception raised for guardrail validation errors.
|
|
|
|
This exception provides detailed context about why a guardrail
|
|
validation failed, including the specific validation that failed
|
|
and any relevant context information.
|
|
|
|
Attributes:
|
|
message: A clear description of the validation error
|
|
context: Optional dictionary containing additional error context
|
|
"""
|
|
def __init__(self, message: str, context: Optional[Dict[str, Any]] = None):
|
|
self.message = message
|
|
self.context = context or {}
|
|
super().__init__(self.message)
|