[API Change] Add new error constructor PandocNoScriptingEngine.

The exit code for this error is 89.
This commit is contained in:
Albert Krewinkel
2022-09-30 08:33:40 -07:00
committed by John MacFarlane
parent 704f337697
commit 14bcb4268b
3 changed files with 10 additions and 3 deletions
+1
View File
@@ -1539,6 +1539,7 @@ Nonzero exit codes have the following meanings:
67 PandocSyntaxMapError
83 PandocFilterError
84 PandocLuaError
89 PandocNoScriptingEngine
91 PandocMacroLoop
92 PandocUTF8DecodingError
93 PandocIpynbDecodingError
+4
View File
@@ -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
+5 -3
View File
@@ -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
}