aboutsummaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-08-24 12:54:39 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-08-24 12:54:39 -0700
commit6e222ce2252637da77a8d7ab460af4f0ce0841c1 (patch)
tree332fc3e67048493f9036be9a4bd8898b03cb7cb5 /pandoc.hs
parentf7c14eddd81dfb89111b482cf49289d9d0135cc2 (diff)
downloadpandoc-6e222ce2252637da77a8d7ab460af4f0ce0841c1.tar.gz
Improved error reporting on filters.
Avoid showing spurious output and avoid double error messages.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/pandoc.hs b/pandoc.hs
index a16ffbc3c..8eed67544 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -91,14 +91,14 @@ isTextFormat :: String -> Bool
isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","epub3"]
externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
-externalFilter f args' d = E.handle filterException $
- do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d
+externalFilter f args' d = do
+ (exitcode, outbs, errbs) <- E.handle filterException $
+ pipeProcess Nothing f args' $ encode d
when (not $ B.null errbs) $ B.hPutStr stderr errbs
case exitcode of
ExitSuccess -> return $ either error id $ eitherDecode' outbs
- ExitFailure _ -> err 83 $ "Error running filter " ++ f ++ "\n" ++
- UTF8.toStringLazy outbs
- where filterException :: E.SomeException -> IO Pandoc
+ ExitFailure _ -> err 83 $ "Error running filter " ++ f
+ where filterException :: E.SomeException -> IO a
filterException e = err 83 $ "Error running filter " ++ f ++
"\n" ++ show e