(exception)
return exception
Takes an Exception instance and strips potentially sensitive information
Takes an Exception instance and strips potentially sensitive information
Takes an Exception instance and strips potentially sensitive information
def clean_exception(exception):
    """
    Takes an Exception instance and strips potentially sensitive information
    """
    from django.conf import settings
    if settings.DEBUG:
        return exception

    # couchdbkit doesn't provide a better way for us to catch this exception
    if (
        isinstance(exception, AssertionError) and
        str(exception).startswith('received an invalid response of type')
    ):
        message = ("It looks like couch returned an invalid response to "
                   "couchdbkit.  This could contain sensitive information, "
                   "so it's being redacted.")
        return exception.__class__(message)

    return exception
def clean_exception ( exception ) : from django . conf import settings if settings . DEBUG : return exception # couchdbkit doesn't provide a better way for us to catch this exception if ( isinstance ( exception , AssertionError ) and str ( exception ) . startswith ( 'received an invalid response of type' ) ) : message = ( "It looks like couch returned an invalid response to " "couchdbkit.  This could contain sensitive information, " "so it's being redacted." ) return exception . __class__ ( message ) return exception