diff options
| author | Albert Krewinkel <[email protected]> | 2022-09-29 11:28:52 +0200 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-09-30 08:33:40 -0700 |
| commit | 14bcb4268b628428c791eebacf204bc00d01da4b (patch) | |
| tree | c75fc9de339eab63ba8bb96f28d49a24790e08f4 /src | |
| parent | 704f337697db0a061817cb02c186841cf999db83 (diff) | |
[API Change] Add new error constructor `PandocNoScriptingEngine`.
The exit code for this error is 89.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Error.hs | 4 | ||||
| -rw-r--r-- | src/Text/Pandoc/Scripting.hs | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs index 3e2479d61..c5ba2aa90 100644 --- a/src/Text/Pandoc/Error.hs +++ b/src/Text/Pandoc/Error.hs @@ -53,6 +53,7 @@ data PandocError = PandocIOError Text IOError | PandocXMLError Text Text | PandocFilterError Text Text | PandocLuaError Text + | PandocNoScriptingEngine | PandocCouldNotFindDataFileError Text | PandocCouldNotFindMetadataFileError Text | PandocResourceNotFound Text @@ -117,6 +118,8 @@ renderError e = PandocFilterError filtername msg -> "Error running filter " <> filtername <> ":\n" <> msg PandocLuaError msg -> "Error running Lua:\n" <> msg + PandocNoScriptingEngine -> "This version of pandoc has been compiled " <> + "without Lua support." PandocCouldNotFindDataFileError fn -> "Could not find data file " <> fn PandocCouldNotFindMetadataFileError fn -> @@ -196,6 +199,7 @@ handleError (Left e) = PandocSyntaxMapError{} -> 67 PandocFilterError{} -> 83 PandocLuaError{} -> 84 + PandocNoScriptingEngine -> 89 PandocMacroLoop{} -> 91 PandocUTF8DecodingError{} -> 92 PandocIpynbDecodingError{} -> 93 diff --git a/src/Text/Pandoc/Scripting.hs b/src/Text/Pandoc/Scripting.hs index a16f273af..ce171c81a 100644 --- a/src/Text/Pandoc/Scripting.hs +++ b/src/Text/Pandoc/Scripting.hs @@ -15,10 +15,12 @@ module Text.Pandoc.Scripting ) where +import Control.Monad.Except (throwError) import Control.Monad.IO.Class (MonadIO) import Data.Text (Text) import Text.Pandoc.Definition (Pandoc) import Text.Pandoc.Class.PandocMonad (PandocMonad) +import Text.Pandoc.Error (PandocError (PandocNoScriptingEngine)) import Text.Pandoc.Filter.Environment (Environment) import Text.Pandoc.Options (ReaderOptions, WriterOptions) import Text.Pandoc.Sources (Sources) @@ -45,9 +47,9 @@ noEngine :: ScriptingEngine noEngine = ScriptingEngine { engineName = "none" , engineApplyFilter = \_env _args _fp _doc -> - error "Custom filters are not supported." + throwError PandocNoScriptingEngine , engineReadCustom = \_fp _ropts _sources -> - error "Custom readers are not supported." + throwError PandocNoScriptingEngine , engineWriteCustom = \_fp _wopts _doc -> - error "Custom writers are not supported." + throwError PandocNoScriptingEngine } |
