mirror of
https://github.com/mfussenegger/nvim-dap
synced 2024-09-16 14:24:03 +02:00
Improve error message for launch.json parse errors (#1285)
Instead of only showing a generic message that something is wrong with the `launch.json` this changes the handling to propagate the error message returned by the JSON decode function. An example that produces an error: ``` :set ff=unix :set bomb ``` Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
This commit is contained in:
parent
5a3775a964
commit
0e889b8616
1 changed files with 5 additions and 1 deletions
|
@ -145,7 +145,11 @@ end
|
|||
|
||||
|
||||
function M._load_json(jsonstr)
|
||||
local data = assert(M.json_decode(jsonstr), "launch.json must contain a JSON object")
|
||||
local ok, data = pcall(M.json_decode, jsonstr)
|
||||
if not ok then
|
||||
error("Error parsing launch.json: " .. data)
|
||||
end
|
||||
assert(type(data) == "table", "launch.json must contain a JSON object")
|
||||
local inputs = create_inputs(data.inputs or {})
|
||||
local has_inputs = next(inputs) ~= nil
|
||||
|
||||
|
|
Loading…
Reference in a new issue