mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-08 04:54:46 +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', [])) })
|
\ { r -> r.exit_status || r.stdout ==# [''] ? '' : call(options.callback, [json_decode(join(r.stdout, ' '))] + get(options, 'callback_args', [])) })
|
||||||
endif
|
endif
|
||||||
let raw = join(FugitiveExecute({'argv': args}).stdout, ' ')
|
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:/
|
catch /^fugitive:/
|
||||||
endtry
|
endtry
|
||||||
endif
|
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 has_key(options, 'callback')
|
||||||
if !v:shell_error && !empty(raw)
|
if !v:shell_error && !empty(raw)
|
||||||
call call(options.callback, [rhubarb#JsonDecode(raw)] + get(options, 'callback_args', []))
|
call call(options.callback, [rhubarb#JsonDecode(raw)] + get(options, 'callback_args', []))
|
||||||
endif
|
endif
|
||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
if raw ==# ''
|
if empty(raw)
|
||||||
return raw
|
throw 'rhubarb: bug? empty response from ' . path
|
||||||
else
|
else
|
||||||
return rhubarb#JsonDecode(raw)
|
return rhubarb#JsonDecode(raw)
|
||||||
endif
|
endif
|
||||||
@@ -263,9 +267,7 @@ function! rhubarb#Complete(findstart, base) abort
|
|||||||
let query = a:base
|
let query = a:base
|
||||||
endif
|
endif
|
||||||
let response = rhubarb#RepoSearch('issues', 'state:open '.query)
|
let response = rhubarb#RepoSearch('issues', 'state:open '.query)
|
||||||
if type(response) != type({})
|
if has_key(response, 'message')
|
||||||
call s:throw('unknown error')
|
|
||||||
elseif has_key(response, 'message')
|
|
||||||
call s:throw(response.message)
|
call s:throw(response.message)
|
||||||
else
|
else
|
||||||
let issues = get(response, 'items', [])
|
let issues = get(response, 'items', [])
|
||||||
|
|||||||
Reference in New Issue
Block a user