(message, metric_name)
Prevent a piece of code from ever causing 500s if it errors

    Instead, report the issue to sentry and track the overall count as a metric
Prevent a piece of code from ever causing 500s if it errors
Prevent a piece of code from ever causing 500s if it errors
def silence_and_report_error(message, metric_name):
    """
    Prevent a piece of code from ever causing 500s if it errors

    Instead, report the issue to sentry and track the overall count as a metric
    """

    try:
        yield
    except Exception:
        notify_exception(None, message)
        metrics_counter(metric_name)
        if settings.UNIT_TESTING:
            raise
def silence_and_report_error ( message , metric_name ) : try : yield except Exception : notify_exception ( None , message ) metrics_counter ( metric_name ) if settings . UNIT_TESTING : raise