aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-05-16 22:33:27 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2018-05-16 22:41:54 +0200
commit48ba3e815f059b3607fa9b707edaa6d7400ffee8 (patch)
tree0aa018c93152c579c3673742ea08be259f0176aa
parent58447bba98cb162b21c30755e0e237f890160a1e (diff)
downloadpandoc-48ba3e815f059b3607fa9b707edaa6d7400ffee8.tar.gz
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.
-rw-r--r--src/Text/Pandoc/Writers/Custom.hs2
1 files changed, 1 insertions, 1 deletions
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