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

Function generic_error_handler

methods/letta/server/rest_api/app.py:174–193  ·  view source on GitHub ↗
(request: Request, exc: Exception)

Source from the content-addressed store, hash-verified

172
173 @app.exception_handler(Exception)
174 async def generic_error_handler(request: Request, exc: Exception):
175 # Log the actual error for debugging
176 log.error(f"Unhandled error: {exc}", exc_info=True)
177 print(f"Unhandled error: {exc}")
178
179 # Print the stack trace
180 print(f"Stack trace: {exc}")
181 if (os.getenv("SENTRY_DSN") is not None) and (os.getenv("SENTRY_DSN") != ""):
182 import sentry_sdk
183
184 sentry_sdk.capture_exception(exc)
185
186 return JSONResponse(
187 status_code=500,
188 content={
189 "detail": "An internal server error occurred",
190 # Only include error details in debug/development mode
191 # "debug_info": str(exc) if settings.debug else None
192 },
193 )
194
195 @app.exception_handler(NoResultFound)
196 async def no_result_found_handler(request: Request, exc: NoResultFound):

Callers

nothing calls this directly

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected