From 3397af30e42bef5cc86b48216860545f364cf40c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 17 Sep 2013 21:38:34 -0700 Subject: More informative error when a filter is not found in path. No more "resource vanished (broken pipe)"! --- pandoc.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandoc.hs b/pandoc.hs index 1ee550940..bf588805b 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -61,6 +61,8 @@ import qualified Data.ByteString.Lazy as B import qualified Data.ByteString as BS import Data.Aeson (eitherDecode', encode) import qualified Data.Map as M +import System.IO.Error(ioeGetErrorType) +import GHC.IO.Exception (IOErrorType(ResourceVanished)) copyrightMessage :: String copyrightMessage = "\nCopyright (C) 2006-2013 John MacFarlane\n" ++ @@ -99,8 +101,11 @@ externalFilter f args' d = do ExitSuccess -> return $ either error id $ eitherDecode' outbs ExitFailure _ -> err 83 $ "Error running filter " ++ f where filterException :: E.SomeException -> IO a - filterException e = err 83 $ "Error running filter " ++ f ++ - "\n" ++ show e + filterException e = err 83 $ "Error running filter " ++ f ++ "\n" ++ + if ioeGetErrorType `fmap` E.fromException e == + Just ResourceVanished + then f ++ " not found in path" + else show e -- | Data structure for command line options. data Opt = Opt -- cgit v1.2.3