diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-10-26 14:46:53 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-10-26 14:46:53 -0700 |
commit | 3d93414e5d433cad21ae2cbf45658d5789571f57 (patch) | |
tree | 08bdb5b0d08d1ab5871c3642f694f51971d96a91 /src/Text/Pandoc/Error.hs | |
parent | dd3d920ba096b3415e11ea0a26d1f5efa4b18cc9 (diff) | |
download | pandoc-3d93414e5d433cad21ae2cbf45658d5789571f57.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc/Error.hs')
-rw-r--r-- | src/Text/Pandoc/Error.hs | 3 |
1 files changed, 3 insertions, 0 deletions
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 |