Skip to content

Commit 2f10aaf

Browse files
authored
Merge pull request #40 from jens1205/rooterror
use nvim_err_writeln for top level error report, use plenary.log for warn message
2 parents d79bd2f + f2c1978 commit 2f10aaf

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lua/rest-nvim/init.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local rest = {}
33
local curl = require('plenary.curl')
44
local path = require('plenary.path')
55
local utils = require('rest-nvim.utils')
6+
local log = require('plenary.log').new { plugin = 'rest.nvim', level = 'warn' }
67

78
-- setup is needed for enabling syntax highlighting for http files
89
rest.setup = function()
@@ -180,9 +181,7 @@ local function get_headers(bufnr, query_line)
180181
break
181182
end
182183
if not line_content:find(':') then
183-
print(
184-
'[rest.nvim] Missing Key/Value pair in message header. Ignoring entry'
185-
)
184+
log.warn("Missing Key/Value pair in message header. Ignoring line: ", line_content)
186185
goto continue
187186
end
188187

@@ -356,10 +355,9 @@ rest.run = function(verbose)
356355
})
357356

358357
if not success_req then
359-
error(
358+
vim.api.nvim_err_writeln(
360359
'[rest.nvim] Failed to perform the request.\nMake sure that you have entered the proper URL and the server is running.\n\nTraceback: '
361-
.. req_err,
362-
2
360+
.. req_err
363361
)
364362
end
365363
end

0 commit comments

Comments
 (0)