fix: gracefully handle html2md failure (#2533)
This commit is contained in:
@@ -21,7 +21,9 @@ function M.fetch_md(url)
|
|||||||
local html2md_lib = M._init_html2md_lib()
|
local html2md_lib = M._init_html2md_lib()
|
||||||
if not html2md_lib then return nil, "Failed to load avante_html2md" end
|
if not html2md_lib then return nil, "Failed to load avante_html2md" end
|
||||||
|
|
||||||
return html2md_lib.fetch_md(url)
|
local ok, res = pcall(html2md_lib.fetch_md, url)
|
||||||
|
if not ok then return nil, res end
|
||||||
|
return res, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user