aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-04-13 19:24:50 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-04-15 11:53:45 +0200
commitd722d93b6118bfed4e0a176a66f859b9636ae689 (patch)
tree47a76eeec866f9650601250c519edbc03ead7ec1 /src/Text/Pandoc/App.hs
parent306dc624d982663e07d91bef6d2f84d311b978af (diff)
downloadpandoc-d722d93b6118bfed4e0a176a66f859b9636ae689.tar.gz
Error: Added PandocFilterError.
Diffstat (limited to 'src/Text/Pandoc/App.hs')
-rw-r--r--src/Text/Pandoc/App.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index b34980c71..77e13a297 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -493,21 +493,17 @@ externalFilter f args' d = liftIO $ do
unless (exists && isExecutable) $ do
mbExe <- findExecutable f'
when (isNothing mbExe) $
- E.throwIO $ PandocAppError 83 $
- "Error running filter " ++ f ++ ":\n" ++
- "Could not find executable '" ++ f' ++ "'."
+ E.throwIO $ PandocFilterError f ("Could not find executable " ++ f')
env <- getEnvironment
let env' = Just $ ("PANDOC_VERSION", pandocVersion) : env
(exitcode, outbs) <- E.handle filterException $
pipeProcess env' f' args'' $ encode d
case exitcode of
ExitSuccess -> return $ either error id $ eitherDecode' outbs
- ExitFailure ec -> E.throwIO $ PandocAppError 83 $
- "Error running filter " ++ f ++ "\n" ++
- "Filter returned error status " ++ show ec
+ ExitFailure ec -> E.throwIO $ PandocFilterError f
+ ("Filter returned error status " ++ show ec)
where filterException :: E.SomeException -> IO a
- filterException e = E.throwIO $ PandocAppError 83 $
- "Error running filter " ++ f ++ "\n" ++ show e
+ filterException e = E.throwIO $ PandocFilterError f (show e)
-- | Data structure for command line options.
data Opt = Opt