Skip to content

Commit c227734

Browse files
committed
placeholder - use pcall to catch errors
1 parent c17a257 commit c227734

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/resources/extensions/quarto/placeholder/placeholder.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ return {
2525
if output_format == "svg" then
2626
result = svg64
2727
else
28-
local mt, contents = pandoc.mediabag.fetch("https://svg2png.deno.dev/" .. svg64)
28+
local pcallresult, mt, contents = pcall(function()
29+
local mt, contents = pandoc.mediabag.fetch("https://svg2png.deno.dev/" .. svg64)
30+
return mt, contents
31+
end)
32+
if not pcallresult then
33+
error("Error rendering placeholder")
34+
error(contents)
35+
return pandoc.Str("Error rendering placeholder")
36+
end
2937
if mt ~= "image/png" then
3038
error("Expected image/png but got " .. mt)
3139
error(contents)

0 commit comments

Comments
 (0)