runtime: Handle failures while loading individual remote plugins

The s:RegistrationCommands functions will now test the type of the "specs" rpc
call. If it's not a list, then the plugin failed to load and is skipped
This commit is contained in:
Thiago de Arruda 2015-04-13 16:43:52 -03:00
parent d119fb7f1d
commit 54bd384338

View File

@ -133,6 +133,11 @@ function! s:RegistrationCommands(host)
let lines = [] let lines = []
for path in paths for path in paths
let specs = rpcrequest(channel, 'specs', path) let specs = rpcrequest(channel, 'specs', path)
if type(specs) != type([])
" host didn't return a spec list, indicates a failure while loading a
" plugin
continue
endif
call add(lines, "call remote#host#RegisterPlugin('".a:host call add(lines, "call remote#host#RegisterPlugin('".a:host
\ ."', '".path."', [") \ ."', '".path."', [")
for spec in specs for spec in specs
@ -244,9 +249,10 @@ function! s:RequirePythonHost(name)
endif endif
catch catch
endtry endtry
throw 'Failed to load python host.' . throw 'Failed to load python host. You can try to see what happened ' .
\ " Try upgrading the Neovim python module with 'pip install --upgrade neovim'" . \ 'by starting Neovim with $NVIM_PYTHON_PYTHON_LOG and opening '.
\ " or see ':help nvim-python'." \ 'the generated log file. Also, the host stderr will be available '.
\ 'in Neovim log, so it may contain useful information.'
endfunction endfunction
call remote#host#Register('python', function('s:RequirePythonHost')) call remote#host#Register('python', function('s:RequirePythonHost'))