aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-20 16:16:32 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-20 16:19:59 +0200
commit32f86067ecea5c8e63952dfec4fb30999d2a1f77 (patch)
tree3b51836c0d29a0eebb9e9ccf899528cb83d5a883 /src/Text
parentb78afbd9803c75fcf2db32b4ce4ded1b8fa0224a (diff)
downloadpandoc-32f86067ecea5c8e63952dfec4fb30999d2a1f77.tar.gz
App: issue proper errors instead of using 'error'.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/App.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 9778911ba..12429b51d 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -520,7 +520,8 @@ externalFilter f args' d = liftIO $ do
(exitcode, outbs) <- E.handle filterException $
pipeProcess env' f' args'' $ encode d
case exitcode of
- ExitSuccess -> return $ either error id $ eitherDecode' outbs
+ ExitSuccess -> either (E.throwIO . PandocFilterError f)
+ return $ eitherDecode' outbs
ExitFailure ec -> E.throwIO $ PandocFilterError f
("Filter returned error status " ++ show ec)
where filterException :: E.SomeException -> IO a
@@ -978,7 +979,7 @@ options =
templ <- getDefaultTemplate Nothing arg
case templ of
Right t -> UTF8.hPutStr stdout t
- Left e -> error $ show e
+ Left e -> E.throwIO $ PandocAppError (show e)
exitSuccess)
"FORMAT")
"" -- "Print default template for FORMAT"