aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-10-05 11:41:59 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2017-10-05 11:41:59 +0200
commit12f8efe0128ade1bd6497a59508f6bd836eb3788 (patch)
tree33ed18e8d90bcd8cdb92d9affcd4ff6145855bbc /src
parent2262f005ce5b39ccd3694f61f2507b9e61c3804c (diff)
downloadpandoc-12f8efe0128ade1bd6497a59508f6bd836eb3788.tar.gz
pandoc.lua: throw better error when pipe command fails
A table containing the error code, command, and command output is thrown instead of just a string error message.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Lua.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs
index 2e4204898..583d43a2e 100644
--- a/src/Text/Pandoc/Lua.hs
+++ b/src/Text/Pandoc/Lua.hs
@@ -196,9 +196,8 @@ runFilterFunction lf x = do
push x
z <- Lua.pcall 1 1 Nothing
when (z /= OK) $ do
- msg <- Lua.peek (-1) <* Lua.pop 1
- let prefix = "Error while running filter function: "
- Lua.throwLuaError $ prefix ++ msg
+ let addPrefix = ("Error while running filter function: " ++)
+ Lua.throwTopMessageAsError' addPrefix
elementOrList :: FromLuaStack a => a -> Lua [a]
elementOrList x = do