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

Function _sanitize_diagnostics

backend/errors.py:259–270  ·  view source on GitHub ↗
(data: Dict[str, Any])

Source from the content-addressed store, hash-verified

257
258
259def _sanitize_diagnostics(data: Dict[str, Any]) -> Dict[str, Any]:
260 sanitized: Dict[str, Any] = {}
261 for key, value in data.items():
262 if value is None:
263 continue
264 if "api_key" in key.lower() or "authorization" in key.lower():
265 sanitized[key] = "***"
266 elif isinstance(value, (str, int, float, bool)):
267 sanitized[key] = _truncate(str(value), 500) if isinstance(value, str) else value
268 else:
269 sanitized[key] = _truncate(str(value), 500)
270 return sanitized
271
272
273def _extract_status_and_message(raw: str) -> Tuple[Optional[int], Optional[str]]:

Callers 2

ensure_app_errorFunction · 0.85
classify_errorFunction · 0.85

Calls 1

_truncateFunction · 0.85

Tested by

no test coverage detected