Merge pull request #556 from blueyed/clarify-_catch_exception

Clarify arguments with _catch_exception
This commit is contained in:
Dave Halter
2016-04-07 22:30:42 +02:00

View File

@@ -62,19 +62,19 @@ def _catch_exception(string, is_eval):
Interface between vim and python calls back to it. Interface between vim and python calls back to it.
Necessary, because the exact error message is not given by `vim.error`. Necessary, because the exact error message is not given by `vim.error`.
""" """
e = 'jedi#_vim_exceptions(%s, %s)' result = vim.eval('jedi#_vim_exceptions({0}, {1})'.format(
result = vim.eval(e % (repr(PythonToVimStr(string, 'UTF-8')), is_eval)) repr(PythonToVimStr(string, 'UTF-8')), int(is_eval)))
if 'exception' in result: if 'exception' in result:
raise VimError(result['exception'], result['throwpoint'], string) raise VimError(result['exception'], result['throwpoint'], string)
return result['result'] return result['result']
def vim_command(string): def vim_command(string):
_catch_exception(string, 0) _catch_exception(string, False)
def vim_eval(string): def vim_eval(string):
return _catch_exception(string, 1) return _catch_exception(string, True)
def no_jedi_warning(error=None): def no_jedi_warning(error=None):