Skip to content

Commit d8ec4e4

Browse files
fix: gracefully handle html2md failure (#2533)
1 parent 53dcb55 commit d8ec4e4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lua/avante/html2md.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ function M.fetch_md(url)
2121
local html2md_lib = M._init_html2md_lib()
2222
if not html2md_lib then return nil, "Failed to load avante_html2md" end
2323

24-
return html2md_lib.fetch_md(url)
24+
local ok, res = pcall(html2md_lib.fetch_md, url)
25+
if not ok then return nil, res end
26+
return res, nil
2527
end
2628

2729
return M

0 commit comments

Comments
 (0)