mirror of
https://github.com/langgenius/dify.git
synced 2026-08-29 02:07:23 +08:00
20 lines
438 B
Python
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"
|