@@ -16,7 +16,7 @@ import Control.Monad ((>=>))
16import qualified Data.Text as T
16import qualified Data.Text as T
17import Text.Pandoc.Class.PandocIO (PandocIO)
17import Text.Pandoc.Class.PandocIO (PandocIO)
18import Text.Pandoc.Definition (Pandoc)
18import Text.Pandoc.Definition (Pandoc)
19−import Text.Pandoc.Error (PandocError (PandocFilterError))
19+import Text.Pandoc.Error (PandocError (PandocFilterError, PandocLuaError))
20import Text.Pandoc.Lua (Global (..), runLua, runFilterFile, setGlobals)
20import Text.Pandoc.Lua (Global (..), runLua, runFilterFile, setGlobals)
21import Text.Pandoc.Options (ReaderOptions)
21import Text.Pandoc.Options (ReaderOptions)
@@ -42,4 +42,6 @@ apply ropts args fp doc = do
42forceResult :: FilePath -> Either PandocError Pandoc -> PandocIO Pandoc
42forceResult :: FilePath -> Either PandocError Pandoc -> PandocIO Pandoc
43forceResult fp eitherResult = case eitherResult of
43forceResult fp eitherResult = case eitherResult of
44 Right x -> return x
44 Right x -> return x
45− Left err -> throw (PandocFilterError (T.pack fp) (T.pack $ show err))
45+ Left err -> throw . PandocFilterError (T.pack fp) $ case err of
46+ PandocLuaError msg -> msg
47+ _ -> T.pack $ show err