LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
fix: Logged errors unhandled by DRF but caught in django's exc handler (#672)
Chandrasekharan M795974898310
diff --git a/backend/middleware/exception.py b/backend/middleware/exception.pyindex c25e471e1..580daa4d1 100644--- a/backend/middleware/exception.py+++ b/backend/middleware/exception.py@@ -68,13 +68,17 @@ class ExceptionLoggingMiddleware:# Handle only when running in production, for debug mode# Django takes care of displaying a detailed HTML page.if not settings.DEBUG and exception:+ logger.error(f"Unhandled exception by DRF for {request}, logging error...")+ ExceptionLoggingMiddleware.format_exc_and_log(+ request=request, exception=exception+ )detail = {"detail": "Error processing the request."}return HttpResponse(json.dumps(detail), status=500)return None@staticmethoddef format_exc_and_log(- request: Request, response: Optional[Response], exception: Exception+ request: Request, exception: Exception, response: Optional[Response] = None) -> None:"""Format the exception to be logged and logs it.