Files
LangBot/src/langbot/libs/deerflow_api/errors.py
Typer_Body 0c6f71738c deerflow
2026-06-07 02:17:40 +08:00

34 lines
874 B
Python

from __future__ import annotations
class DeerFlowAPIError(Exception):
"""DeerFlow API 请求失败"""
def __init__(
self,
*,
operation: str = '',
status: int = 0,
body: str = '',
url: str = '',
thread_id: str | None = None,
message: str = '',
) -> None:
self.operation = operation
self.status = status
self.body = body
self.url = url
self.thread_id = thread_id
if message:
super().__init__(message)
return
msg = f'DeerFlow {operation} failed: status={status}, url={url}, body={body}'
if thread_id is not None:
msg = (
f'DeerFlow {operation} failed: thread_id={thread_id}, '
f'status={status}, url={url}, body={body}'
)
super().__init__(msg)