From 12f8efe0128ade1bd6497a59508f6bd836eb3788 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 5 Oct 2017 11:41:59 +0200 Subject: 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. --- src/Text/Pandoc/Lua.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc') 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 -- cgit v1.2.3