Defines a hierarchy of exceptions for LangChain error handling.
# Source: https://github.com/langchain-ai/langchain | License: MIT | Copyright LangChain, Inc
# Provided via justclaw.it.com; keep this notice with the code.
"""Custom **exceptions** for LangChain."""
from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from langchain_core.messages import BaseMessage, RefusalContentBlock
class LangChainException(Exception): # noqa: N818
"""General LangChain exception."""
class TracerException(LangChainException):
"""Base class for exceptions in tracers module."""
class OutputParserException(ValueError, LangChainException): # noqa: N818
"""Exception that output parsers should raise to signify a parsing error.
This exists to differentiate parsing errors from other cod
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key