aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Filter
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-03-25 22:16:27 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2020-04-17 21:52:48 +0200
commitfb54f3d6792d2f8e7b05e458b59142f8ae6bb3e2 (patch)
treeb5403849735559bd28050fe8bccf068bdf37f48a /src/Text/Pandoc/Filter
parent2877ca70ecaf5b6715b38f41165974f89206d18b (diff)
downloadpandoc-fb54f3d6792d2f8e7b05e458b59142f8ae6bb3e2.tar.gz
API change: use PandocError for exceptions in Lua subsystem
The PandocError type is used throughout the Lua subsystem, all Lua functions throw an exception of this type if an error occurs. The `LuaException` type is removed and no longer exported from `Text.Pandoc.Lua`. In its place, a new constructor `PandocLuaError` is added to PandocError.
Diffstat (limited to 'src/Text/Pandoc/Filter')
-rw-r--r--src/Text/Pandoc/Filter/Lua.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Filter/Lua.hs b/src/Text/Pandoc/Filter/Lua.hs
index a50e5217d..8df057bfa 100644
--- a/src/Text/Pandoc/Filter/Lua.hs
+++ b/src/Text/Pandoc/Filter/Lua.hs
@@ -17,8 +17,7 @@ import qualified Data.Text as T
import Text.Pandoc.Class.PandocIO (PandocIO)
import Text.Pandoc.Definition (Pandoc)
import Text.Pandoc.Error (PandocError (PandocFilterError))
-import Text.Pandoc.Lua (Global (..), LuaException (..),
- runLua, runFilterFile, setGlobals)
+import Text.Pandoc.Lua (Global (..), runLua, runFilterFile, setGlobals)
import Text.Pandoc.Options (ReaderOptions)
-- | Run the Lua filter in @filterPath@ for a transformation to the
@@ -40,7 +39,7 @@ apply ropts args fp doc = do
]
runFilterFile fp doc
-forceResult :: FilePath -> Either LuaException Pandoc -> PandocIO Pandoc
+forceResult :: FilePath -> Either PandocError Pandoc -> PandocIO Pandoc
forceResult fp eitherResult = case eitherResult of
- Right x -> return x
- Left (LuaException s) -> throw (PandocFilterError (T.pack fp) s)
+ Right x -> return x
+ Left err -> throw (PandocFilterError (T.pack fp) (T.pack $ show err))