How to filter out errors which are handled by try catch

As per Sentry docs even if the user handles the exception it will be logged in sentry with handled flag as yes.

But how to avoid the logging of handled exceptions in sentry ??

I am using sentry-sdk (0.14.1) and below integrations:

hey @thiyaguby you could use the beforeSend callback.

@marandaneto Thanks for the suggestion.

How do I get the handled flag inside that beforeSend method… ?? I tried that but couldn’t find that flag in the arguments…

cc @untitaker

No news on this? I have the exact same problem. Requests are made, with a ton a catches (Exception, requests.ConnectionError, requests.HTTPError, requests.RequestException, NewConnectionError, MaxRetryError) and with a filter:

def before_send(event, hint):
    if 'exc_info' in hint:
        exc_type, exc_value, tb = hint['exc_info']
        if isinstance(exc_value, SSLError):
            event['fingerprint'] = ['ssl-error']
        if isinstance(exc_value, NewConnectionError):
            event['fingerprint'] = ['new-connection-error']
        if isinstance(exc_value, MaxRetryError):
            event['fingerprint'] = ['max-retry-error']
    return event

And still, I receive the emails and get (un-grouped) entries on Sentry. I can’t get it working. Any idea?

To be precise, this is the message I get on Sentry:

HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /operations/obsSchedule.php?d=2020-08-13&a=1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f53166db730>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

I thought that witch catches and a before_send method, I could filter them out, or at least group them. Which one I should catch ?

Can you link two issues that are supposed to be grouped together?

Why do you mean by “link”? I often merge issues, but that’s it. They keep coming separated.