Closed torgeirl closed 1 year ago
(...) from the system side this error is unnecessary and shouldn't be generated.
Fixed by preventing the exception from being forwarded to Sentry with before_send
filtering:
from urllib.parse import urlparse
from sentry_sdk import init as sentry_init
(...)
def before_send(event, hint):
'''Ignore errors caused by faulty preview input.'''
url_string = event['request']['url']
parsed_url = urlparse(url_string)
if parsed_url.path == '/devilry_comment/_api/preview-markdown':
if 'exc_info' in hint:
exc_type, exc_value, tb = hint['exc_info']
if isinstance(exc_value, ValueError):
return None
return event
(...)
sentry_init(
(...)
before_send=before_send,
(...)
Similar to #1228,
ValueError
from/devilry_comment/_api/preview-markdown
(comment message previews failing due to syntax errors in code/markdown input) doesn't provide any actionable data.From the user's perspective it is handled well, but from the system side this error is unnecessary and shouldn't be generated.