summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-10-01 16:10:46 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2018-10-01 16:32:11 +0200
commit9abdbb2783d246c736f05119390e81084f9ab07c (patch)
tree31cce79a7dbfb12ab376602bbf505002a6844d8e /src/Text/Pandoc/Lua.hs
parent1ffe47b9b9d1bdd204046adfcfb1496195ffa383 (diff)
Lua filters: report traceback when an error occurs
A proper Lua traceback is added if either loading of a file or execution of a filter function fails. This should be of help to authors of Lua filters who need to debug their code.
Diffstat (limited to 'src/Text/Pandoc/Lua.hs')
-rw-r--r--src/Text/Pandoc/Lua.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs
index c4e5791b6..e160f7123 100644
--- a/src/Text/Pandoc/Lua.hs
+++ b/src/Text/Pandoc/Lua.hs
@@ -39,6 +39,7 @@ import Text.Pandoc.Class (PandocIO)
import Text.Pandoc.Definition (Pandoc)
import Text.Pandoc.Lua.Filter (LuaFilter, walkMWithLuaFilter)
import Text.Pandoc.Lua.Init (LuaException (..), runPandocLua, registerScriptPath)
+import Text.Pandoc.Lua.Util (dofileWithTraceback)
import Text.Pandoc.Options (ReaderOptions)
import qualified Foreign.Lua as Lua
@@ -58,7 +59,7 @@ runLuaFilter' ropts filterPath format pd = do
registerReaderOptions
registerScriptPath filterPath
top <- Lua.gettop
- stat <- Lua.dofile filterPath
+ stat <- dofileWithTraceback filterPath
if stat /= Lua.OK
then Lua.throwTopMessage
else do