Add error handling to rename function
parent
3d45012e80
commit
8a7beffa83
Binary file not shown.
|
|
@ -25,9 +25,11 @@ function M.rename_session(prompt_bufnr)
|
||||||
end
|
end
|
||||||
new_filename = utils.encode_session(input, opts) .. ".json"
|
new_filename = utils.encode_session(input, opts) .. ".json"
|
||||||
new_filename = utils.full_filename(new_filename)
|
new_filename = utils.full_filename(new_filename)
|
||||||
vim.notify("old: " .. vim.inspect(old_filename) .. " new: " .. vim.inspect(new_filename))
|
|
||||||
local ok, err, _ = vim.uv.fs_rename(old_filename, new_filename)
|
local ok, err, _ = vim.uv.fs_rename(old_filename, new_filename)
|
||||||
vim.notify(vim.inspect(err))
|
if not ok then
|
||||||
|
vim.notify("Error renaming session\n" .. vim.inspect(err))
|
||||||
|
return
|
||||||
|
end
|
||||||
-- Refresh the picker
|
-- Refresh the picker
|
||||||
actions.close(prompt_bufnr)
|
actions.close(prompt_bufnr)
|
||||||
M.resession_picker()
|
M.resession_picker()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue