feat: Implement centralized error capture and handling with new middleware, services, and API endpoints, and add new admin and statistics API views.

This commit is contained in:
pacnpal
2026-01-02 15:55:42 -05:00
parent 1adba1b804
commit 95700c7d7b
43 changed files with 2477 additions and 158 deletions

View File

@@ -46,6 +46,7 @@ from apps.api.v1.serializers.rides import (
RideUpdateInputSerializer,
)
from apps.core.decorators.cache_decorators import cache_api_response
from apps.core.utils import capture_and_log
from apps.rides.services.hybrid_loader import SmartRideLoader
logger = logging.getLogger(__name__)
@@ -2059,7 +2060,7 @@ class HybridRideAPIView(APIView):
return Response(response_data, status=status.HTTP_200_OK)
except Exception as e:
logger.error(f"Error in HybridRideAPIView: {e}")
capture_and_log(e, 'Get hybrid rides', source='api')
return Response(
{"detail": "Internal server error"},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
@@ -2358,7 +2359,7 @@ class RideFilterMetadataAPIView(APIView):
return Response(metadata, status=status.HTTP_200_OK)
except Exception as e:
logger.error(f"Error in RideFilterMetadataAPIView: {e}")
capture_and_log(e, 'Get ride filter metadata', source='api')
return Response(
{"detail": "Internal server error"},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,