From 913db947a9cb43b6f449db2cd4c85fd74aa1ac8f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 2 Apr 2017 23:02:55 +0200 Subject: Text.Pandoc.App: Throw errors rather than exiting. These are caught (and lead to exit) in pandoc.hs, but other uses of Text.Pandoc.App may want to recover in another way. Added PandocAppError to PandocError (API change). This is a stopgap: later we should have a separate constructor for each type of error. Also fixed uses of 'exit' in Shared.readDataFile, and removed 'err' from Shared (API change). Finally, removed the dependency on extensible-exceptions. See #3548. --- pandoc.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pandoc.hs') diff --git a/pandoc.hs b/pandoc.hs index f4fcd328a..6135aec03 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -34,6 +34,9 @@ writers. -} module Main where import Text.Pandoc.App (convertWithOpts, defaultOpts, options, parseOptions) +import Text.Pandoc.Error (handleError, PandocError) +import qualified Control.Exception as E main :: IO () -main = parseOptions options defaultOpts >>= convertWithOpts +main = E.catch (parseOptions options defaultOpts >>= convertWithOpts) + (\(e :: PandocError) -> handleError (Left e)) -- cgit v1.2.3