2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 14:11:37 +00:00

Error tweaks (#10250)

* Refactor sentry checks

* Refresh output from db before printing
This commit is contained in:
Oliver
2025-09-02 20:15:21 +10:00
committed by GitHub
parent 35c398dfde
commit 73af9b18ed
2 changed files with 20 additions and 7 deletions

View File

@@ -72,9 +72,20 @@ def report_exception(exc, scope: Optional[dict] = None):
'report_exception should not be called in testing mode'
)
if settings.SENTRY_ENABLED and settings.SENTRY_DSN:
if not any(isinstance(exc, e) for e in sentry_ignore_errors()):
logger.info('Reporting exception to sentry.io: %s', exc)
# Skip if sentry not enabled, or not configured
if not settings.SENTRY_ENABLED or not settings.SENTRY_DSN:
return
# Skip if this error type is in the ignore list
if any(isinstance(exc, e) for e in sentry_ignore_errors()):
return
# Error may also be passed in from the loggingn context
if hasattr(exc, 'event'):
event = getattr(exc, 'event', None)
if any(isinstance(event, e) for e in sentry_ignore_errors()):
return
try:
sentry_sdk.capture_exception(exc, scope=scope)

View File

@@ -207,6 +207,8 @@ class LabelPrint(GenericAPIView):
output=None,
)
output.refresh_from_db()
offload_task(
report.tasks.print_labels,
template.pk,