summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-04-02 23:02:55 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-04-02 23:04:48 +0200
commit913db947a9cb43b6f449db2cd4c85fd74aa1ac8f (patch)
tree48af245903a81e6d80f1e8b7f4c8f519d1e7571b /pandoc.hs
parent9e78a9d26b73fa603025789a942f70306aaaad22 (diff)
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.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs5
1 files changed, 4 insertions, 1 deletions
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))