MCPcopy Index your code
hub / github.com/Tong89/smartNode / error_response

Function error_response

backend/errors.py:28–39  ·  view source on GitHub ↗

构造脱敏的统一错误响应 (body, http_status)。

(code, message=None, status=None, details=None)

Source from the content-addressed store, hash-verified

26
27
28def error_response(code, message=None, status=None, details=None):
29 """构造脱敏的统一错误响应 (body, http_status)。"""
30 default_status, default_msg = ERROR_CODES.get(code, (500, "服务内部错误"))
31 body = {
32 "status": "error",
33 "code": code,
34 "message": message or default_msg,
35 "request_id": uuid.uuid4().hex[:12], # 便于把客户端报错关联到服务端日志
36 }
37 if details is not None:
38 body["details"] = details
39 return jsonify(body), (status or default_status)
40
41
42def register_error_handlers(app):

Callers 15

wrapperFunction · 0.90
get_debug_statusFunction · 0.90
get_requests_paginatedFunction · 0.90
get_snapshot_atFunction · 0.90
update_ground_stationsFunction · 0.90
update_leo_satellitesFunction · 0.90
get_data_combinationsFunction · 0.90
scenario_saveFunction · 0.90
scenario_loadFunction · 0.90
scenario_exportFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected