MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / validation_error

Function validation_error

lib/cli/tests/test_run_usage.py:596–611  ·  view source on GitHub ↗

Pydantic's ValidationError, for the error a validator raised, or, given None, for a field that is missing.

(raised_by_validator: Exception | None)

Source from the content-addressed store, hash-verified

594
595
596def validation_error(raised_by_validator: Exception | None) -> Exception:
597 """Pydantic's ValidationError, for the error a validator raised, or, given
598 None, for a field that is missing."""
599 from pydantic import BaseModel, ValidationError, field_validator
600
601 class Agent(BaseModel):
602 llm: str
603
604 @field_validator("llm")
605 @classmethod
606 def build(cls, value: str) -> str:
607 raise raised_by_validator
608
609 with pytest.raises(ValidationError) as raised:
610 Agent.model_validate({"llm": SECRET} if raised_by_validator else {})
611 return raised.value
612
613
614def projects_own_error(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected