From 48ba3e815f059b3607fa9b707edaa6d7400ffee8 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 16 May 2018 22:33:27 +0200 Subject: 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. --- src/Text/Pandoc/Writers/Custom.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs index 53b321c7c..c0940ad78 100644 --- a/src/Text/Pandoc/Writers/Custom.hs +++ b/src/Text/Pandoc/Writers/Custom.hs @@ -113,7 +113,7 @@ writeCustom luaFile opts doc@(Pandoc meta _) = do -- check for error in lua script (later we'll change the return type -- to handle this more gracefully): when (stat /= OK) $ - tostring 1 >>= throw . PandocLuaException . UTF8.toString + tostring (-1) >>= throw . PandocLuaException . UTF8.toString -- TODO - call hierarchicalize, so we have that info rendered <- docToCustom opts doc context <- metaToJSON opts -- cgit v1.2.3