mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 16:35:18 -05:00
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:
@@ -4,6 +4,8 @@ from django.db.models.signals import post_save, pre_save
|
||||
from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
|
||||
from apps.core.utils import capture_and_log
|
||||
|
||||
from .models import Ride
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -126,7 +128,13 @@ def handle_ride_transition_to_closing(instance, source, target, user, **kwargs):
|
||||
return True
|
||||
|
||||
if not instance.post_closing_status:
|
||||
logger.error(f"Cannot transition ride {instance.pk} to CLOSING: " "post_closing_status not set")
|
||||
# Capture to dashboard as a validation error
|
||||
capture_and_log(
|
||||
ValueError('post_closing_status not set for CLOSING transition'),
|
||||
f'Ride transition to CLOSING for ride {instance.pk}',
|
||||
source='signal',
|
||||
severity='medium',
|
||||
)
|
||||
return False
|
||||
|
||||
if not instance.closing_date:
|
||||
|
||||
Reference in New Issue
Block a user