git.iko.soy/typeable/pandoc
on master help sign in
More informative error when a filter is not found in path.

No more "resource vanished (broken pipe)"!

commit3397af30e42bef5cc86b48216860545f364cf40c authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 17 Sep 2013, 21:38 (13 years ago) parent32afe85
1 file changed+7−2
pandoc.hs+7−2
pandoc.hs+7−2
@@ -61,6 +61,8 @@ import qualified Data.ByteString.Lazy as B
6161import qualified Data.ByteString as BS
6262import Data.Aeson (eitherDecode', encode)
6363import qualified Data.Map as M
64+import System.IO.Error(ioeGetErrorType)
65+import GHC.IO.Exception (IOErrorType(ResourceVanished))
6466
6567copyrightMessage :: String
6668copyrightMessage = "\nCopyright (C) 2006-2013 John MacFarlane\n" ++
@@ -99,8 +101,11 @@ externalFilter f args' d = do
99101 ExitSuccess -> return $ either error id $ eitherDecode' outbs
100102 ExitFailure _ -> err 83 $ "Error running filter " ++ f
101103 where filterException :: E.SomeException -> IO a
102− filterException e = err 83 $ "Error running filter " ++ f ++
103− "\n" ++ show e
104+ filterException e = err 83 $ "Error running filter " ++ f ++ "\n" ++
105+ if ioeGetErrorType `fmap` E.fromException e ==
106+ Just ResourceVanished
107+ then f ++ " not found in path"
108+ else show e
104109
105110-- | Data structure for command line options.
106111data Opt = Opt