summaryrefslogtreecommitdiffstats
path: root/stator/models.py
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-20 12:24:03 -0700
committerAndrew Godwin2022-11-20 12:24:03 -0700
commit77643a4fe144cb908a372a2ceb99f36634457ca5 (patch)
tree92e37e8a9e242a31d915eb60a0ab0c14bda2bcec /stator/models.py
parentfacdd2c08094ad378351375541fa8e65459fa8d1 (diff)
downloadtakahe-77643a4fe144cb908a372a2ceb99f36634457ca5.tar.gz
takahe-77643a4fe144cb908a372a2ceb99f36634457ca5.tar.bz2
takahe-77643a4fe144cb908a372a2ceb99f36634457ca5.zip
Add more error handling
Diffstat (limited to 'stator/models.py')
-rw-r--r--stator/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/stator/models.py b/stator/models.py
index df385dd..a84f8c2 100644
--- a/stator/models.py
+++ b/stator/models.py
@@ -4,6 +4,7 @@ import traceback
from typing import ClassVar, List, Optional, Type, Union, cast
from asgiref.sync import sync_to_async
+from django.conf import settings
from django.db import models, transaction
from django.utils import timezone
from django.utils.functional import classproperty
@@ -154,6 +155,10 @@ class StatorModel(models.Model):
next_state = await current_state.handler(self)
except BaseException as e:
await StatorError.acreate_from_instance(self, e)
+ if settings.SENTRY_ENABLED:
+ from sentry_sdk import capture_exception
+
+ capture_exception(e)
traceback.print_exc()
else:
if next_state: