aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-10-16 21:36:53 +0200
committerAlbert Krewinkel <[email protected]>2022-10-16 21:38:25 +0200
commitaf2b4c47bb1759ca7c41169987526ea0f53c973a (patch)
tree08da9b2cf5a00fd194424d2b125a769ff4c73683 /pandoc-lua-engine/src
parentc8ef079c0f63b4fa496d4d0692b167053a97fcb8 (diff)
Lua: fix rendering of Lua errors in Lua
Otherwise the `Error running Lua` message can be prepended multiple times.
Diffstat (limited to 'pandoc-lua-engine/src')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/PandocError.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/PandocError.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/PandocError.hs
index 0e0e00dbd..c9721a53d 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/PandocError.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/PandocError.hs
@@ -30,7 +30,9 @@ import qualified Text.Pandoc.UTF8 as UTF8
typePandocError :: LuaError e => DocumentedType e PandocError
typePandocError = deftype "PandocError"
[ operation Tostring $ defun "__tostring"
- ### liftPure renderError
+ ### liftPure (\case
+ PandocLuaError e -> e
+ err -> renderError err)
<#> udparam typePandocError "obj" "PandocError object"
=#> functionResult pushText "string" "string representation of error."
]