@@ -493,21 +493,17 @@ externalFilter f args' d = liftIO $ do
493 unless (exists && isExecutable) $ do
493 unless (exists && isExecutable) $ do
494 mbExe <- findExecutable f'
494 mbExe <- findExecutable f'
495 when (isNothing mbExe) $
495 when (isNothing mbExe) $
496− E.throwIO $ PandocAppError 83 $
497− "Error running filter " ++ f ++ ":\n" ++
498− "Could not find executable '" ++ f' ++ "'."
496+ E.throwIO $ PandocFilterError f ("Could not find executable " ++ f')
499 env <- getEnvironment
497 env <- getEnvironment
500 let env' = Just $ ("PANDOC_VERSION", pandocVersion) : env
498 let env' = Just $ ("PANDOC_VERSION", pandocVersion) : env
501 (exitcode, outbs) <- E.handle filterException $
499 (exitcode, outbs) <- E.handle filterException $
502 pipeProcess env' f' args'' $ encode d
500 pipeProcess env' f' args'' $ encode d
503 case exitcode of
501 case exitcode of
504 ExitSuccess -> return $ either error id $ eitherDecode' outbs
502 ExitSuccess -> return $ either error id $ eitherDecode' outbs
505− ExitFailure ec -> E.throwIO $ PandocAppError 83 $
503+ ExitFailure ec -> E.throwIO $ PandocFilterError f
506− "Error running filter " ++ f ++ "\n" ++
507− "Filter returned error status " ++ show ec
504+ ("Filter returned error status " ++ show ec)
508 where filterException :: E.SomeException -> IO a
505 where filterException :: E.SomeException -> IO a
509− filterException e = E.throwIO $ PandocAppError 83 $
506+ filterException e = E.throwIO $ PandocFilterError f (show e)
510− "Error running filter " ++ f ++ "\n" ++ show e
512-- | Data structure for command line options.
508-- | Data structure for command line options.
513data Opt = Opt
509data Opt = Opt