From 3d93414e5d433cad21ae2cbf45658d5789571f57 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 26 Oct 2020 14:46:53 -0700 Subject: Add PandocBibliographyError and use it in parsing bibliographies. This ensures that bibliography parsing errors generate messages that include the bibliography file name -- otherwise it can be quite mysterious where it is coming from. [API change] New PandocBibliographyError constructor on PandocError type. --- src/Text/Pandoc/Error.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Text/Pandoc/Error.hs') diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs index bd24fec6f..93028ccca 100644 --- a/src/Text/Pandoc/Error.hs +++ b/src/Text/Pandoc/Error.hs @@ -62,6 +62,7 @@ data PandocError = PandocIOError Text IOError | PandocUnknownWriterError Text | PandocUnsupportedExtensionError Text Text | PandocCiteprocError CiteprocError + | PandocBibliographyError Text Text deriving (Show, Typeable, Generic) instance Exception PandocError @@ -143,6 +144,8 @@ handleError (Left e) = "for " <> f PandocCiteprocError e' -> err 24 $ prettyCiteprocError e' + PandocBibliographyError fp msg -> err 25 $ + "Error reading bibliography file " <> fp <> ":\n" <> msg err :: Int -> Text -> IO a err exitCode msg = do -- cgit v1.2.3