MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / api_error_handler

Function api_error_handler

methods/mem0/client/main.py:26–40  ·  view source on GitHub ↗

Decorator to handle API errors consistently.

(func)

Source from the content-addressed store, hash-verified

24
25
26def api_error_handler(func):
27 """Decorator to handle API errors consistently."""
28
29 @wraps(func)
30 def wrapper(*args, **kwargs):
31 try:
32 return func(*args, **kwargs)
33 except httpx.HTTPStatusError as e:
34 logger.error(f"HTTP error occurred: {e}")
35 raise APIError(f"API request failed: {e.response.text}")
36 except httpx.RequestError as e:
37 logger.error(f"Request error occurred: {e}")
38 raise APIError(f"Request failed: {str(e)}")
39
40 return wrapper
41
42
43class MemoryClient:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected