def safe_filter(error_output='<STR_LIT>'):
def inner(f):<EOL><INDENT>@wraps(f)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>try:<EOL><INDENT>return f(*args, **kwargs)<EOL><DEDENT>except Exception as err:<EOL><INDENT>if sorl_settings.THUMBNAIL_DEBUG:<EOL><INDENT>raise<EOL><DEDENT>logger.error('<STR_LIT>' % str(err),<EOL>exc_info=sys.exc_info())<EOL>return error_output<EOL><DEDENT><DEDENT>return wrapper<EOL><DEDENT>return inner<EOL>
A safe filter decorator only raising errors when ``THUMBNAIL_DEBUG`` is
``True`` otherwise returning ``error_output``.