From 77643a4fe144cb908a372a2ceb99f36634457ca5 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 20 Nov 2022 12:24:03 -0700 Subject: Add more error handling --- stator/runner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'stator/runner.py') diff --git a/stator/runner.py b/stator/runner.py index d286bc1..ed459be 100644 --- a/stator/runner.py +++ b/stator/runner.py @@ -5,6 +5,7 @@ import traceback import uuid from typing import List, Optional, Type +from django.conf import settings from django.utils import timezone from stator.models import StatorModel @@ -90,7 +91,11 @@ class StatorRunner: f"Attempting transition on {instance._meta.label_lower}#{instance.pk} from state {instance.state}" ) await instance.atransition_attempt() - except BaseException: + except BaseException as e: + if settings.SENTRY_ENABLED: + from sentry_sdk import capture_exception + + capture_exception(e) traceback.print_exc() def remove_completed_tasks(self): -- cgit v1.2.3