mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 04:05:25 -05:00
feat: replace direct logger.error with capture_and_log for critical state machine callback failures.
This commit is contained in:
@@ -75,6 +75,8 @@ from typing import Any, Optional
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
from apps.core.utils import capture_and_log
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -496,9 +498,12 @@ class TransitionCallbackRegistry:
|
|||||||
failures.append((callback, None))
|
failures.append((callback, None))
|
||||||
overall_success = False
|
overall_success = False
|
||||||
|
|
||||||
if not callback.continue_on_error:
|
if not callback.continue_on_error:
|
||||||
logger.error(
|
capture_and_log(
|
||||||
f"Aborting callback chain - {callback.name} failed " f"and continue_on_error=False"
|
RuntimeError(f'Callback {callback.name} returned False'),
|
||||||
|
f'Aborting callback chain - continue_on_error=False',
|
||||||
|
source='state_machine',
|
||||||
|
severity='medium',
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -508,8 +513,11 @@ class TransitionCallbackRegistry:
|
|||||||
overall_success = False
|
overall_success = False
|
||||||
|
|
||||||
if not callback.continue_on_error:
|
if not callback.continue_on_error:
|
||||||
logger.error(
|
capture_and_log(
|
||||||
f"Aborting callback chain - {callback.name} raised exception " f"and continue_on_error=False"
|
e,
|
||||||
|
f'Aborting callback chain - {callback.name} raised exception',
|
||||||
|
source='state_machine',
|
||||||
|
severity='high',
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user