def jsonex_api(f):
@wraps(f)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>try:<EOL><INDENT>code, res = <NUM_LIT:200>, f(*args, **kwargs)<EOL><DEDENT>except HTTPException as e:<EOL><INDENT>code, res = e.code, {'<STR_LIT:error>': e}<EOL><DEDENT>except Exception as e:<EOL><INDENT>code, res = <NUM_LIT>, {'<STR_LIT:error>': e}<EOL>logger.exception('<STR_LIT>')<EOL><DEDENT>response = make_response(jsonex_dumps(res), code)<EOL>response.headers['<STR_LIT:Content-Type>'] = '<STR_LIT:application/json>'<EOL>return response<EOL><DEDENT>return wrapper<EOL>
View wrapper for JsonEx responses. Catches exceptions as well