diff --git a/autoload/rhubarb.vim b/autoload/rhubarb.vim index 31ae42e..d794932 100644 --- a/autoload/rhubarb.vim +++ b/autoload/rhubarb.vim @@ -201,19 +201,23 @@ function! rhubarb#Request(path, ...) abort \ { r -> r.exit_status || r.stdout ==# [''] ? '' : call(options.callback, [json_decode(join(r.stdout, ' '))] + get(options, 'callback_args', [])) }) endif let raw = join(FugitiveExecute({'argv': args}).stdout, ' ') - return empty(raw) ? raw : json_decode(raw) + if empty(raw) + throw 'rhubarb: bug? empty response from ' . path + else + return json_decode(raw) + endif catch /^fugitive:/ endtry endif - let raw = system(join(map(copy(args), 's:shellesc(v:val)'), ' ')) + silent let raw = system(join(map(copy(args), 's:shellesc(v:val)'), ' ')) if has_key(options, 'callback') if !v:shell_error && !empty(raw) call call(options.callback, [rhubarb#JsonDecode(raw)] + get(options, 'callback_args', [])) endif return {} endif - if raw ==# '' - return raw + if empty(raw) + throw 'rhubarb: bug? empty response from ' . path else return rhubarb#JsonDecode(raw) endif @@ -263,9 +267,7 @@ function! rhubarb#Complete(findstart, base) abort let query = a:base endif let response = rhubarb#RepoSearch('issues', 'state:open '.query) - if type(response) != type({}) - call s:throw('unknown error') - elseif has_key(response, 'message') + if has_key(response, 'message') call s:throw(response.message) else let issues = get(response, 'items', [])