mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-06 12:14:26 +08:00
Remove special case for empty response body
Not sure if this served a purpose, so let's find out.
This commit is contained in:
@@ -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', [])
|
||||
|
||||
Reference in New Issue
Block a user