diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2012-11-29 21:16:30 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2012-11-30 01:27:25 +1100 |
commit | 77ef6ca06d401eda2aeb51d22d5ce033db667161 (patch) | |
tree | 21dd2e159a9b7ec568147b6c27e74dc9da954492 /compiler/ghci | |
parent | 086d7c54f5bddbc9e5d94a9ae9c4b5aeeab53a35 (diff) | |
download | haskell-77ef6ca06d401eda2aeb51d22d5ce033db667161.tar.gz |
Replace all uses of ghcError with throwGhcException and purge ghcError.
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/ByteCodeGen.lhs | 2 | ||||
-rw-r--r-- | compiler/ghci/ByteCodeLink.lhs | 2 | ||||
-rw-r--r-- | compiler/ghci/LibFFI.hsc | 2 | ||||
-rw-r--r-- | compiler/ghci/Linker.lhs | 26 |
4 files changed, 16 insertions, 16 deletions
diff --git a/compiler/ghci/ByteCodeGen.lhs b/compiler/ghci/ByteCodeGen.lhs index bd636c9b77..2b332a4581 100644 --- a/compiler/ghci/ByteCodeGen.lhs +++ b/compiler/ghci/ByteCodeGen.lhs @@ -1465,7 +1465,7 @@ bcIdUnaryType x = case repType (idType x) of -- See bug #1257 unboxedTupleException :: a unboxedTupleException - = ghcError + = throwGhcException (ProgramError ("Error: bytecode compiler can't handle unboxed tuples.\n"++ " Possibly due to foreign import/export decls in source.\n"++ diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs index 8938bfe4f1..6fcb7f4f66 100644 --- a/compiler/ghci/ByteCodeLink.lhs +++ b/compiler/ghci/ByteCodeLink.lhs @@ -240,7 +240,7 @@ lookupIE dflags ie con_nm linkFail :: String -> String -> IO a linkFail who what - = ghcError (ProgramError $ + = throwGhcException (ProgramError $ unlines [ "",who , "During interactive linking, GHCi couldn't find the following symbol:" , ' ' : ' ' : what diff --git a/compiler/ghci/LibFFI.hsc b/compiler/ghci/LibFFI.hsc index 128197109b..d46d1b94cd 100644 --- a/compiler/ghci/LibFFI.hsc +++ b/compiler/ghci/LibFFI.hsc @@ -52,7 +52,7 @@ prepForeignCall dflags cconv arg_types result_type let res_ty = primRepToFFIType dflags result_type r <- ffi_prep_cif cif abi (fromIntegral n_args) res_ty arg_arr if (r /= fFI_OK) - then ghcError (InstallationError + then throwGhcException (InstallationError (printf "prepForeignCallFailed: %d" (show r))) else return cif diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 3ba9c3c36a..7d36337fc1 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -172,7 +172,7 @@ getHValue hsc_env name = do pls <- modifyPLS $ \pls -> do if (isExternalName name) then do (pls', ok) <- linkDependencies hsc_env pls noSrcSpan [nameModule name] - if (failed ok) then ghcError (ProgramError "") + if (failed ok) then throwGhcException (ProgramError "") else return (pls', pls') else return (pls, pls) @@ -321,7 +321,7 @@ reallyInitDynLinker dflags = ; ok <- resolveObjs ; if succeeded ok then maybePutStrLn dflags "done" - else ghcError (ProgramError "linking extra libraries/objects failed") + else throwGhcException (ProgramError "linking extra libraries/objects failed") ; return pls }} @@ -403,7 +403,7 @@ preloadLib dflags lib_paths framework_paths lib_spec preloadFailed :: String -> [String] -> LibrarySpec -> IO () preloadFailed sys_errmsg paths spec = do maybePutStr dflags "failed.\n" - ghcError $ + throwGhcException $ CmdLineError ( "user specified .o/.so/.DLL could not be loaded (" ++ sys_errmsg ++ ")\nWhilst trying to load: " @@ -455,7 +455,7 @@ linkExpr hsc_env span root_ul_bco -- Link the packages and modules required ; (pls, ok) <- linkDependencies hsc_env pls0 span needed_mods ; if failed ok then - ghcError (ProgramError "") + throwGhcException (ProgramError "") else do { -- Link the expression itself @@ -480,7 +480,7 @@ linkExpr hsc_env span root_ul_bco -- by default, so we can safely ignore them here. dieWith :: DynFlags -> SrcSpan -> MsgDoc -> IO a -dieWith dflags span msg = ghcError (ProgramError (showSDoc dflags (mkLocMessage SevFatal span msg))) +dieWith dflags span msg = throwGhcException (ProgramError (showSDoc dflags (mkLocMessage SevFatal span msg))) checkNonStdWay :: DynFlags -> SrcSpan -> IO Bool @@ -566,7 +566,7 @@ getLinkDeps hsc_env hpt pls replace_osuf span mods mb_iface <- initIfaceCheck hsc_env $ loadInterface msg mod (ImportByUser False) iface <- case mb_iface of - Maybes.Failed err -> ghcError (ProgramError (showSDoc dflags err)) + Maybes.Failed err -> throwGhcException (ProgramError (showSDoc dflags err)) Maybes.Succeeded iface -> return iface when (mi_boot iface) $ link_boot_mod_error mod @@ -594,7 +594,7 @@ getLinkDeps hsc_env hpt pls replace_osuf span mods link_boot_mod_error mod = - ghcError (ProgramError (showSDoc dflags ( + throwGhcException (ProgramError (showSDoc dflags ( text "module" <+> ppr mod <+> text "cannot be linked; it is only available as a boot module"))) @@ -677,7 +677,7 @@ linkDecls hsc_env span (ByteCode unlinkedBCOs itblEnv) = do -- Link the packages and modules required (pls, ok) <- linkDependencies hsc_env pls0 span needed_mods if failed ok - then ghcError (ProgramError "") + then throwGhcException (ProgramError "") else do -- Link the expression itself @@ -717,7 +717,7 @@ linkModule hsc_env mod = do initDynLinker (hsc_dflags hsc_env) modifyPLS_ $ \pls -> do (pls', ok) <- linkDependencies hsc_env pls noSrcSpan [mod] - if (failed ok) then ghcError (ProgramError "could not link module") + if (failed ok) then throwGhcException (ProgramError "could not link module") else return pls' \end{code} @@ -1084,7 +1084,7 @@ linkPackages' dflags new_pks pls = do ; return (new_pkg : pkgs') } | otherwise - = ghcError (CmdLineError ("unknown package: " ++ packageIdString new_pkg)) + = throwGhcException (CmdLineError ("unknown package: " ++ packageIdString new_pkg)) linkPackage :: DynFlags -> PackageConfig -> IO () @@ -1140,7 +1140,7 @@ linkPackage dflags pkg maybePutStr dflags "linking ... " ok <- resolveObjs if succeeded ok then maybePutStrLn dflags "done." - else ghcError (InstallationError ("unable to load package `" ++ display (sourcePackageId pkg) ++ "'")) + else throwGhcException (InstallationError ("unable to load package `" ++ display (sourcePackageId pkg) ++ "'")) -- we have already searched the filesystem; the strings passed to load_dyn -- can be passed directly to loadDLL. They are either fully-qualified @@ -1151,7 +1151,7 @@ load_dyn :: FilePath -> IO () load_dyn dll = do r <- loadDLL dll case r of Nothing -> return () - Just err -> ghcError (CmdLineError ("can't load .so/.DLL for: " + Just err -> throwGhcException (CmdLineError ("can't load .so/.DLL for: " ++ dll ++ " (" ++ err ++ ")" )) loadFrameworks :: Platform -> InstalledPackageInfo_ ModuleName -> IO () @@ -1166,7 +1166,7 @@ loadFrameworks platform pkg load fw = do r <- loadFramework fw_dirs fw case r of Nothing -> return () - Just err -> ghcError (CmdLineError ("can't load framework: " + Just err -> throwGhcException (CmdLineError ("can't load framework: " ++ fw ++ " (" ++ err ++ ")" )) -- Try to find an object file for a given library in the given paths. |