Skip to content

Commit

Permalink
feat(updater): add error message for improper packer snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jun 6, 2022
1 parent 6ea467e commit 3003b03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/core/utils/updater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ options.pin_plugins = options.pin_plugins == true and options.channel == "stable
or options.pin_plugins
if type(options.pin_plugins) == "string" then
local loaded, snapshot_file = pcall(fn.readfile, fn.stdpath "config" .. "/snapshots/" .. options.pin_plugins)
local snapshot
if loaded then
local _, snapshot = pcall(fn.json_decode, snapshot_file)
loaded, snapshot = pcall(fn.json_decode, snapshot_file)
astronvim.updater.snapshot = type(snapshot) == "table" and snapshot or nil
end
if not loaded then
vim.api.nvim_err_writeln("Error loading snapshot: " .. options.pin_plugins)
end
end

function astronvim.updater.version()
Expand Down

0 comments on commit 3003b03

Please sign in to comment.