mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 11:35:41 +00:00
Ignore validation errors when uploading to sentry.io (#4594)
* Ignore validation errors when uploading to sentry.io * Don't actually return, silly!
This commit is contained in:
@ -64,7 +64,15 @@ def exception_handler(exc, context):
|
||||
if settings.SENTRY_ENABLED and settings.SENTRY_DSN and not settings.DEBUG:
|
||||
# Report this exception to sentry.io
|
||||
from sentry_sdk import capture_exception
|
||||
capture_exception(exc)
|
||||
|
||||
# The following types of errors are ignored, they are "expected"
|
||||
do_not_report = [
|
||||
DjangoValidationError,
|
||||
DRFValidationError,
|
||||
]
|
||||
|
||||
if not any([isinstance(exc, err) for err in do_not_report]):
|
||||
capture_exception(exc)
|
||||
|
||||
# Catch any django validation error, and re-throw a DRF validation error
|
||||
if isinstance(exc, DjangoValidationError):
|
||||
|
Reference in New Issue
Block a user