Skip to content

Commit

Permalink
fix(utils): improve error logging and notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Sep 30, 2024
1 parent af549f9 commit 807b6ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/hurl/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,16 @@ util.find_env_files_in_folders = function()
end
util.has_file_in_opts = function(opts)
if #opts == 0 then
vim.notify('No file path provided in opts.', vim.log.levels.DEBUG)
util.log_error('No file path provided in opts.')
return false
end

local file_path = opts[1]

local file = io.open(file_path, 'r')
if not file then
print('Error: Failed to open file: ' .. file_path)
util.log_error('Error: Failed to open file: ' .. file_path)
vim.notify('Error: Failed to open file: ' .. file_path, vim.log.levels.ERROR)
return false
end

Expand Down

0 comments on commit 807b6ff

Please sign in to comment.