From 306dc624d982663e07d91bef6d2f84d311b978af Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 13 Apr 2017 17:38:42 +0200 Subject: Error: Added PandocPDFError --- src/Text/Pandoc/App.hs | 2 +- src/Text/Pandoc/Error.hs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index e44c6ebfb..b34980c71 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -451,7 +451,7 @@ convertWithOpts opts = do Left err' -> liftIO $ do B.hPutStr stderr err' B.hPut stderr $ B.pack [10] - E.throwIO $ PandocAppError 43 "Error producing PDF" + E.throwIO $ PandocPDFError (UTF8.toStringLazy err') | otherwise -> do let htmlFormat = format `elem` ["html","html4","html5","s5","slidy","slideous","dzslides","revealjs"] diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs index 36e9cca63..b6782036f 100644 --- a/src/Text/Pandoc/Error.hs +++ b/src/Text/Pandoc/Error.hs @@ -55,6 +55,7 @@ data PandocError = PandocIOError String IOError | PandocSyntaxMapError String | PandocFailOnWarningError | PandocPDFProgramNotFoundError String + | PandocPDFError String | PandocAppError Int String deriving (Show, Typeable, Generic) @@ -86,6 +87,7 @@ handleError (Left e) = PandocFailOnWarningError -> err 3 "Failing because there were warnings." PandocPDFProgramNotFoundError pdfprog -> err 47 $ pdfprog ++ " not found. " ++ pdfprog ++ " is needed for pdf output." + PandocPDFError log -> err 43 $ "Error producing PDF.\n" ++ log PandocAppError ec s -> err ec s err :: Int -> String -> IO a -- cgit v1.2.3