summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-08-13 23:11:33 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-08-13 23:11:33 -0700
commitf6b5735d095dcfe2b0ef4aab02ff85acb47140c6 (patch)
treefbfb22b2c47c934796a7f79bdafab57326cf5d53 /pandoc.hs
parentbd73d73a28acc2863bd52bdc6f0f9d850fa34d84 (diff)
Added module for writing python scripts, with several examples.
See scripts subdirectory.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/pandoc.hs b/pandoc.hs
index 1c0a49a73..0df4cc555 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -91,14 +91,16 @@ isTextFormat :: String -> Bool
isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","epub3"]
externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
-externalFilter f args' d = E.catch
- (do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d
+externalFilter f args' d = E.handle filterException $
+ do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d
case exitcode of
ExitSuccess -> return $ either error id $ eitherDecode' outbs
- ExitFailure _ -> err 83 $ "Error running filter `" ++ UTF8.toStringLazy outbs ++
- UTF8.toStringLazy errbs ++ "'")
- (\e -> let _ = (e :: E.SomeException)
- in err 83 $ "Error running filter `" ++ f ++ "'")
+ ExitFailure _ -> err 83 $ "Error running filter " ++ f ++ "\n" ++
+ UTF8.toStringLazy outbs ++
+ UTF8.toStringLazy errbs
+ where filterException :: E.SomeException -> IO Pandoc
+ filterException e = err 83 $ "Error running filter " ++ f ++
+ "\n" ++ show e
-- | Data structure for command line options.
data Opt = Opt