aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-04-19 08:38:31 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-04-19 08:38:31 -0700
commit16d372abcb991caf26077c7f1cd0be4680894170 (patch)
tree8b384f635b89ae742e71490df1cbb5cbedaa0506 /src/Text/Pandoc/Writers.hs
parent73d394ca2adff31a384404ae25665b36c7d0bba0 (diff)
downloadpandoc-16d372abcb991caf26077c7f1cd0be4680894170.tar.gz
Issue error message when reader or writer format is malformed.
Previously we exited with an error status but (due to a bug) no message. Closes #7231.
Diffstat (limited to 'src/Text/Pandoc/Writers.hs')
-rw-r--r--src/Text/Pandoc/Writers.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers.hs b/src/Text/Pandoc/Writers.hs
index 95d6270b5..c348477c2 100644
--- a/src/Text/Pandoc/Writers.hs
+++ b/src/Text/Pandoc/Writers.hs
@@ -81,6 +81,7 @@ import Data.Aeson
import qualified Data.ByteString.Lazy as BL
import Data.Text (Text)
import qualified Data.Text as T
+import Text.Pandoc.Shared (tshow)
import Text.Pandoc.Class
import Text.Pandoc.Definition
import Text.Pandoc.Options
@@ -122,7 +123,6 @@ import Text.Pandoc.Writers.Texinfo
import Text.Pandoc.Writers.Textile
import Text.Pandoc.Writers.XWiki
import Text.Pandoc.Writers.ZimWiki
-import Text.Parsec.Error
data Writer m = TextWriter (WriterOptions -> Pandoc -> m Text)
| ByteStringWriter (WriterOptions -> Pandoc -> m BL.ByteString)
@@ -196,8 +196,8 @@ writers = [
getWriter :: PandocMonad m => Text -> m (Writer m, Extensions)
getWriter s =
case parseFormatSpec s of
- Left e -> throwError $ PandocAppError
- $ T.intercalate "\n" [T.pack m | Message m <- errorMessages e]
+ Left e -> throwError $ PandocAppError $
+ "Error parsing writer format " <> tshow s <> ": " <> tshow e
Right (writerName, extsToEnable, extsToDisable) ->
case lookup writerName writers of
Nothing -> throwError $