def web_method_wrapper(func):
    @functools.wraps(func)
    @gen.coroutine
    def wrapper(self, *args, **kwargs):
        self.init_rsp_json()

        try:
            yield func(self, *args, **kwargs)
            yield self.finished()
        except BaseError as e:
            self.rsp_json['code']  = e.e_code
            self.rsp_json['msg']  = e.e_msg

            self.api_response(self.rsp_json)
            gen_logger.error(e, exc_info=options.traceback_4_baseerror)

            yield self.on_error(e)
        except __HOLE__ as e:
            raise e
        except Exception as e:
            self.api_response(self.rsp_json)
            gen_logger.error(e, exc_info=options.traceback_4_exception)

            yield self.on_error(e)

    return wrapper
dataset/ETHPy150Open bufferx/twork/twork/web/action_wrapper.py/web_method_wrapper