git.iko.soy/typeable/pandoc
on master help sign in
App: issue proper errors instead of using 'error'.
commit32f86067ecea5c8e63952dfec4fb30999d2a1f77 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 20 Jun 2017, 16:16 (9 years ago) parentb78afbd
1 file changed+3−2
src/Text/Pandoc/App.hs+3−2
src/Text/Pandoc/App.hs+3−2
@@ -520,7 +520,8 @@ externalFilter f args' d = liftIO $ do
520520 (exitcode, outbs) <- E.handle filterException $
521521 pipeProcess env' f' args'' $ encode d
522522 case exitcode of
523− ExitSuccess -> return $ either error id $ eitherDecode' outbs
523+ ExitSuccess -> either (E.throwIO . PandocFilterError f)
524+ return $ eitherDecode' outbs
524525 ExitFailure ec -> E.throwIO $ PandocFilterError f
525526 ("Filter returned error status " ++ show ec)
526527 where filterException :: E.SomeException -> IO a
@@ -978,7 +979,7 @@ options =
978979 templ <- getDefaultTemplate Nothing arg
979980 case templ of
980981 Right t -> UTF8.hPutStr stdout t
981− Left e -> error $ show e
982+ Left e -> E.throwIO $ PandocAppError (show e)
982983 exitSuccess)
983984 "FORMAT")
984985 "" -- "Print default template for FORMAT"