summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/PDF.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-04-12 21:18:21 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-04-12 21:18:21 -0700
commita9628d0745784f6f99edfca008d64dcffeb74bc8 (patch)
tree5b39dab3a6c357e755f84c788c5bdf47610c8ddf /src/Text/Pandoc/PDF.hs
parenta21c5ba7c8a9d9b79aec92d5eaa4966cb7fe2052 (diff)
Text.Pandoc.PDF: more comprehensible errors on image conversion.
Closes #2067. EPS can't be supported without shelling out to something like ImageMagick, but at least we can avoid mysterious error messages. We now get: pandoc: Unable to convert `circle.eps' for use with pdflatex. ! Package pdftex.def Error: File `circle-eps-converted-to.pdf' not found. which seems more straightforward.
Diffstat (limited to 'src/Text/Pandoc/PDF.hs')
-rw-r--r--src/Text/Pandoc/PDF.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index 59a6ebede..8d9e69ee1 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -108,8 +108,7 @@ convertImages tmpdir (Image ils (src, tit)) = do
img <- convertImage tmpdir src
newPath <-
case img of
- Left e -> src <$
- warn ("Unable to convert image `" ++ src ++ "':\n" ++ e)
+ Left e -> src <$ warn e
Right fp -> return fp
return (Image ils (newPath, tit))
convertImages _ x = return x
@@ -123,7 +122,8 @@ convertImage tmpdir fname =
Just "application/pdf" -> doNothing
_ -> JP.readImage fname >>= \res ->
case res of
- Left msg -> return $ Left msg
+ Left msg -> return $ Left $ "Unable to convert `" ++
+ fname ++ "' for use with pdflatex."
Right img ->
E.catch (Right fileOut <$ JP.savePngImage fileOut img) $
\(e :: E.SomeException) -> return (Left (show e))