Explicitly print exception from :try block

Reason: :try takes any output to the stderr as the exception, so traceback is 
never printed even though nothing is caught.
This commit is contained in:
ZyX 2014-08-26 19:57:45 +04:00
parent b6e8318ce9
commit 81d8a9e180
1 changed files with 13 additions and 8 deletions

View File

@ -62,14 +62,19 @@ endfunction
try try
let s:can_replace_pyeval = !exists('g:powerline_pyeval') let s:can_replace_pyeval = !exists('g:powerline_pyeval')
call s:rcmd("try:") call s:rcmd("try:")
call s:rcmd(" ".s:import_cmd."") call s:rcmd(" try:")
call s:rcmd("except ImportError:") call s:rcmd(" ".s:import_cmd."")
call s:rcmd(" import sys, vim") call s:rcmd(" except ImportError:")
call s:rcmd(" sys.path.append(vim.eval('expand(\"<sfile>:h:h:h:h:h\")'))") call s:rcmd(" import sys, vim")
call s:rcmd(" ".s:import_cmd."") call s:rcmd(" sys.path.append(vim.eval('expand(\"<sfile>:h:h:h:h:h\")'))")
call s:rcmd("import vim") call s:rcmd(" ".s:import_cmd."")
call s:rcmd("VimPowerline().setup(pyeval=vim.eval('s:pyeval'), pycmd=vim.eval('s:pycmd'), can_replace_pyeval=int(vim.eval('s:can_replace_pyeval')))") call s:rcmd(" import vim")
call s:rcmd("del VimPowerline") call s:rcmd(" VimPowerline().setup(pyeval=vim.eval('s:pyeval'), pycmd=vim.eval('s:pycmd'), can_replace_pyeval=int(vim.eval('s:can_replace_pyeval')))")
call s:rcmd(" del VimPowerline")
call s:rcmd("except Exception:")
call s:rcmd(" import traceback, sys")
call s:rcmd(" traceback.print_exc(file=sys.stdout)")
call s:rcmd(" raise")
execute s:pycmd s:pystr execute s:pycmd s:pystr
unlet s:pystr unlet s:pystr
let s:launched = 1 let s:launched = 1