def _wrap_function(self, fn, sync, decode, nvim_bind, name, *args): if decode: args = walk(decode_if_bytes, args, decode) if nvim_bind is not None: args.insert(0, nvim_bind) try: return fn(*args) except Exception: if sync: msg = ("error caught in request handler '{} {}':\n{}".format( name, args, format_exc_skip(1))) raise ErrorResponse(msg) else: msg = ("error caught in async handler '{} {}'\n{}\n".format( name, args, format_exc_skip(1))) self._on_async_err(msg + "\n")
def eval(self, expr): obj = self.request("vim_eval", expr) return walk(num_to_str, obj)