dify/api/machinery/errors.py
2026-08-05 02:36:16 +00:00

20 lines
438 B
Python

"""Framework-neutral errors raised by API machinery.
They deliberately do not carry Flask responses, Werkzeug exceptions, HTTP
status codes, or surface-specific wire models.
"""
from typing import NamedTuple
class ErrorDetail(NamedTuple):
type: str
location: tuple[str | int, ...]
message: str
class MachineryError(Exception):
"""Base class for failures owned by API machinery."""
code: str = "machinery_error"