From 6fbb8d6739b353752dc405452fb41f9cdf20a0b9 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 16 Feb 2018 13:33:23 -0500 Subject: provider: Safely access job.stderr in #Require If `jobstart()` fails, then the subsequent `rpcrequest()` will throw due to an invalid channel id. This causes `job.stderr` not to exist, so we throw another exception when trying to dump the job's stderr. Error detected while processing function remote#define#AutocmdBootstrap[1]..remote#host#Require[10]..provider#pythonx#Require: line 22: E716: Key not present in Dictionary: stderr This obfuscates the actual problem. --- runtime/autoload/provider/node.vim | 2 +- runtime/autoload/provider/pythonx.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index 3dde18022e..493eecf433 100644 --- a/runtime/autoload/provider/node.vim +++ b/runtime/autoload/provider/node.vim @@ -81,7 +81,7 @@ function! provider#node#Require(host) abort catch echomsg v:throwpoint echomsg v:exception - for row in job.stderr + for row in get(job, 'stderr', []) echomsg row endfor endtry diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 1c77eabe23..f9aa09b16b 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -29,7 +29,7 @@ function! provider#pythonx#Require(host) abort catch echomsg v:throwpoint echomsg v:exception - for row in job.stderr + for row in get(job, 'stderr', []) echomsg row endfor endtry -- cgit