Skip to content

Commit 40634fa

Browse files
authored
fix: don't try to parse response on curl nonzero exit (#238)
1 parent f1a45ac commit 40634fa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lua/plenary/curl.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,15 @@ request = function(specs)
244244
command = "curl",
245245
args = args,
246246
on_exit = function(j, code)
247+
if code ~= 0 then
248+
error(string.format(
249+
"%s %s - curl error exit_code=%s stderr=%s",
250+
opts.method,
251+
opts.url,
252+
code,
253+
vim.inspect(j:stderr_result())
254+
))
255+
end
247256
local output = parse.response(j:result(), opts.dump[2], code)
248257
if opts.callback then
249258
return opts.callback(output)

0 commit comments

Comments
 (0)