summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Error.hs4
-rw-r--r--src/Text/Pandoc/Readers.hs3
-rw-r--r--src/Text/Pandoc/Writers.hs3
3 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs
index c5ba2aa90..b53e39ca3 100644
--- a/src/Text/Pandoc/Error.hs
+++ b/src/Text/Pandoc/Error.hs
@@ -64,6 +64,7 @@ data PandocError = PandocIOError Text IOError
| PandocUTF8DecodingError Text Int Word8
| PandocIpynbDecodingError Text
| PandocUnsupportedCharsetError Text
+ | PandocFormatError Text Text
| PandocUnknownReaderError Text
| PandocUnknownWriterError Text
| PandocUnsupportedExtensionError Text Text
@@ -140,6 +141,8 @@ renderError e =
"ipynb decoding error: " <> w
PandocUnsupportedCharsetError charset ->
"Unsupported charset " <> charset
+ PandocFormatError format s ->
+ "Error parsing format " <> tshow format <> ": " <> s
PandocUnknownReaderError r ->
"Unknown input format " <> r <>
case r of
@@ -181,6 +184,7 @@ handleError (Left e) =
PandocAppError{} -> 4
PandocTemplateError{} -> 5
PandocOptionError{} -> 6
+ PandocFormatError{} -> 20
PandocUnknownReaderError{} -> 21
PandocUnknownWriterError{} -> 22
PandocUnsupportedExtensionError{} -> 23
diff --git a/src/Text/Pandoc/Readers.hs b/src/Text/Pandoc/Readers.hs
index 7abd1d024..eef455627 100644
--- a/src/Text/Pandoc/Readers.hs
+++ b/src/Text/Pandoc/Readers.hs
@@ -166,8 +166,7 @@ readers = [("native" , TextReader readNative)
getReader :: PandocMonad m => Text -> m (Reader m, Extensions)
getReader s =
case parseFormatSpec s of
- Left e -> throwError $ PandocAppError $
- "Error parsing reader format " <> tshow s <> ": " <> tshow e
+ Left e -> throwError $ PandocFormatError s (tshow e)
Right (readerName, extsToEnable, extsToDisable) ->
case lookup readerName readers of
Nothing -> throwError $ PandocUnknownReaderError
diff --git a/src/Text/Pandoc/Writers.hs b/src/Text/Pandoc/Writers.hs
index f4e1f9040..385f1352f 100644
--- a/src/Text/Pandoc/Writers.hs
+++ b/src/Text/Pandoc/Writers.hs
@@ -196,8 +196,7 @@ writers = [
getWriter :: PandocMonad m => Text -> m (Writer m, Extensions)
getWriter s =
case parseFormatSpec s of
- Left e -> throwError $ PandocAppError $
- "Error parsing writer format " <> tshow s <> ": " <> tshow e
+ Left e -> throwError $ PandocFormatError s (tshow e)
Right (writerName, extsToEnable, extsToDisable) ->
case lookup writerName writers of
Nothing -> throwError $