Skip to content

Commit

Permalink
fix(sync): Better error message if entry can't be parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Dec 17, 2023
1 parent 26f6357 commit 0e9d622
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions lua/rocks/operations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,29 +305,35 @@ operations.sync = function(user_rocks)

for _, key in ipairs(to_install) do
nio.scheduler()
progress_handle:report({
message = ("Installing: %s"):format(key),
})
-- If the plugin version is a development release then we pass `dev` as the version to the install function
-- as it gets converted to the `--dev` flag on there, allowing luarocks to pull the `scm-1` rockspec manifest
local future
if vim.startswith(user_rocks[key].version, "scm-") then
future = operations.install(user_rocks[key].name, "dev")
if not user_rocks[key].version then
local message = ("Could not parse rock: %s"):format(vim.inspect(user_rocks[key]))
log.error(message)
report_error(message)
else
future = operations.install(user_rocks[key].name, user_rocks[key].version)
end
local success = pcall(future.wait)

ct = ct + 1
nio.scheduler()
if not success then
progress_handle:report({ percentage = get_progress_percentage() })
report_error(("Failed to install %s."):format(key))
progress_handle:report({
message = ("Installing: %s"):format(key),
})
-- If the plugin version is a development release then we pass `dev` as the version to the install function
-- as it gets converted to the `--dev` flag on there, allowing luarocks to pull the `scm-1` rockspec manifest
local future
if vim.startswith(user_rocks[key].version, "scm-") then
future = operations.install(user_rocks[key].name, "dev")
else
future = operations.install(user_rocks[key].name, user_rocks[key].version)
end
local success = pcall(future.wait)

ct = ct + 1
nio.scheduler()
if not success then
progress_handle:report({ percentage = get_progress_percentage() })
report_error(("Failed to install %s."):format(key))
end
progress_handle:report({
message = ("Installed: %s"):format(key),
percentage = get_progress_percentage(),
})
end
progress_handle:report({
message = ("Installed: %s"):format(key),
percentage = get_progress_percentage(),
})
end
for _, key in ipairs(to_updowngrade) do
local is_downgrading = vim.version.parse(user_rocks[key].version)
Expand Down

0 comments on commit 0e9d622

Please sign in to comment.