diff --git a/hpygments.cabal b/hpygments.cabal
--- a/hpygments.cabal
+++ b/hpygments.cabal
@@ -1,5 +1,5 @@
 Name:               hpygments
-Version:            0.1.2
+Version:            0.1.3
 Synopsis:           Highlight source code using Pygments
 Description:
     Highlight source code using Pygments <http://pygments.org>. This package
diff --git a/src/Text/Highlighting/Pygments.hs b/src/Text/Highlighting/Pygments.hs
--- a/src/Text/Highlighting/Pygments.hs
+++ b/src/Text/Highlighting/Pygments.hs
@@ -30,7 +30,8 @@
     -- $examples
     ) where
 
-import System.Process (readProcess)
+import System.Exit
+import System.Process (readProcessWithExitCode)
 
 import Text.Highlighting.Pygments.Lexers
 import Text.Highlighting.Pygments.Formatters
@@ -51,7 +52,12 @@
 pygmentize :: LexerAlias -> FormatterAlias -> Options -> String -> IO String
 pygmentize lexer formatter options code = do
     let args = ["-l", lexer, "-f", formatter] ++ optionsToArgs options
-    readProcess "pygmentize" args code
+    (exitCode, stdout, stderr) <- readProcessWithExitCode "pygmentize" args code
+    case exitCode of
+        ExitSuccess -> return stdout
+        -- TODO throw a custom exception?
+        e -> error $ "hpygments: `pygmentize " ++ unwords args ++ "` failed: " 
+                   ++ show e ++ if stderr /= "" then ": " ++ stderr else ""
 
 -- | The lexer/formatter option @(key, value)@ is passed to the @pygmentize@ 
 -- script via the command-line flag @-P key=value@.
