Custom writer: fix error message on script failure
Error messages produced by Lua were not displayed by Pandoc. The writer
was using the bottom-most stack element, while the error message is the
top-most element. This lead to the writer to always show "Lua 5.3" as
error message, disregarding the actual message.
commit48ba3e815f059b3607fa9b707edaa6d7400ffee8
authorAlbert Krewinkel <albert@zeitkraut.de>
dateWed 16 May 2018, 22:33 (8 years ago)
parent58447bb
src/Text/Pandoc/Writers/Custom.hs+1−1
@@ -113,7 +113,7 @@ writeCustom luaFile opts doc@(Pandoc meta _) = do
113113 -- check for error in lua script (later we'll change the return type
114114 -- to handle this more gracefully):
115115 when (stat /= OK) $
116− tostring 1 >>= throw . PandocLuaException . UTF8.toString
116+ tostring (-1) >>= throw . PandocLuaException . UTF8.toString
117117 -- TODO - call hierarchicalize, so we have that info
118118 rendered <- docToCustom opts doc
119119 context <- metaToJSON opts