MCPcopy
hub / github.com/HisMax/RedInk / api_error_response

Function api_error_response

backend/routes/utils.py:57–63  ·  view source on GitHub ↗

返回统一结构化 API 错误响应。

(error, status: int = None, context: dict = None)

Source from the content-addressed store, hash-verified

55
56
57def api_error_response(error, status: int = None, context: dict = None):
58 """返回统一结构化 API 错误响应。"""
59 app_error = ensure_app_error(error, context=context)
60 if status is not None:
61 app_error.status = status
62 status_code = app_error.status
63 return jsonify(error_payload(app_error)), status_code
64
65
66def validation_error(detail: str, suggestion: str = "请检查输入后重试") -> AppError:

Callers 15

get_configFunction · 0.85
update_configFunction · 0.85
test_connectionFunction · 0.85
create_historyFunction · 0.85
list_historyFunction · 0.85
get_historyFunction · 0.85
check_history_existsFunction · 0.85
update_historyFunction · 0.85
delete_historyFunction · 0.85
search_historyFunction · 0.85
get_history_statsFunction · 0.85
scan_taskFunction · 0.85

Calls 2

ensure_app_errorFunction · 0.90
error_payloadFunction · 0.90

Tested by 1

test_connectionFunction · 0.68