Skip to content

Commit

Permalink
feat: better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jan 6, 2025
1 parent 28e648d commit d9e975d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/neotest-golang/lib/sanitize.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
logger = require("neotest-golang.lib.logger")

local M = {}

local function isSequentialList(t)
Expand Down Expand Up @@ -37,7 +39,11 @@ end
---@param replacement string? Optional replacement character (defaults to U+FFFD REPLACEMENT CHARACTER)
---@return string The sanitized string
function M.sanitize_string(str, replacement)
local utf8 = require("utf8")
local success, utf8 = pcall(require, "utf8")
if not success then
logger.error("Failed to load uga-rosa/utf8.nvim")
end

replacement = replacement or utf8.char(0xFFFD) -- Unicode replacement character
local sanitized_string = ""

Expand Down

0 comments on commit d9e975d

Please sign in to comment.