       Just err <- cModuleErrorMessage m
       disposeCModule m
       return $ Left err
-    False -> do
+    False -> catch (doParse m) exHandler
+  where
+    exHandler :: TranslationException -> IO (Either String Module)
+    exHandler ex = return $ Left (show ex)
+    doParse m = do
       ref <- newIORef 0
       res <- evalStateT (mfix (tieKnot m)) (emptyState ref)
 

module Data.LLVM.Private.Parser.Unmarshal ( parseLLVMBitcodeFile ) where

#include "c++/marshal.h"

import Control.Applicative
import Control.DeepSeq

    ValFunction -> throw InvalidFunctionInTranslateValue
    ValAlias -> throw InvalidAliasInTranslateValue
    ValGlobalvariable -> throw InvalidGlobalVarInTranslateValue
    ValConstantexpr -> translateConstantExpr finalState (castPtr dataPtr)

  uid <- nextId

