Nothing -> do
mod <- moduleNameToModule mn
if isHomeModule mod
- then throwDyn (UserError (showSDoc
+ then throwDyn (CmdLineError (showSDoc
(quotes (ppr (moduleName mod))
<+> text "is not currently loaded")))
else return mod
moduleNameToModule mn
= do maybe_stuff <- findModule mn
case maybe_stuff of
- Nothing -> throwDyn (UserError ("can't find module `"
+ Nothing -> throwDyn (CmdLineError ("can't find module `"
++ moduleNameUserString mn ++ "'"))
Just (m,_) -> return m
| haskellish_file file
= do exists <- doesFileExist file
if exists then summariseFile file else do
- throwDyn (UserError ("can't find file `" ++ file ++ "'"))
+ throwDyn (CmdLineError ("can't find file `" ++ file ++ "'"))
| otherwise
= do exists <- doesFileExist hs_file
if exists then summariseFile hs_file else do
let old_summary = findModInSummaries old_summaries mod
summarise mod location old_summary
- Nothing -> throwDyn (UserError
+ Nothing -> throwDyn (CmdLineError
("can't find module `"
++ showSDoc (ppr nm) ++ "'"))
let (srcimps,imps,mod_name) = getImports modsrc
when (mod_name /= moduleName mod) $
- throwDyn (UserError
+ throwDyn (ProgramError
(showSDoc (text modsrc
<> text ": file name does not match module name"
<+> quotes (ppr (moduleName mod)))))
= panic (showSDoc (text "no source file for module" <+> quotes (ppr mod)))
packageModErr mod
- = throwDyn (UserError (showSDoc (text "module" <+>
+ = throwDyn (CmdLineError (showSDoc (text "module" <+>
quotes (ppr mod) <+>
text "is a package module")))
\end{code}
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.59 2001/03/28 11:01:19 simonmar Exp $
+-- $Id: InteractiveUI.hs,v 1.60 2001/03/28 16:51:03 simonmar Exp $
--
-- GHC Interactive User Interface
--
io ( putStrLn ("Phase " ++ phase ++ " failed (code "
++ show code ++ ")"))
Interrupted -> io (putStrLn "Interrupted.")
+ -- omit the location for CmdLineError
+ CmdLineError s -> io (putStrLn s)
other -> io (putStrLn (show (ghc_ex :: GhcException)))
other -> io (putStrLn ("*** Exception: " ++ show exception))
foldr1 (\a b -> a ++ ',':b) (map fst cs)
++ ")") >> return False)
-noArgs c = throwDyn (UserError ("command `" ++ c ++ "' takes no arguments"))
+noArgs c = throwDyn (CmdLineError ("command `" ++ c ++ "' takes no arguments"))
-----------------------------------------------------------------------------
-- Commands
setContext :: String -> GHCi ()
setContext ""
- = throwDyn (UserError "syntax: `:m <module>'")
+ = throwDyn (CmdLineError "syntax: `:m <module>'")
setContext m | not (isUpper (head m)) || not (all isAlphaNum (tail m))
- = throwDyn (UserError ("strange looking module name: `" ++ m ++ "'"))
+ = throwDyn (CmdLineError ("strange looking module name: `" ++ m ++ "'"))
setContext str
= do st <- getGHCiState
new_cmstate <- io (cmSetContext (cmstate st) str)
let (macro_name, definition) = break isSpace s
cmds <- io (readIORef commands)
if (null macro_name)
- then throwDyn (UserError "invalid macro name")
+ then throwDyn (CmdLineError "invalid macro name")
else do
if (macro_name `elem` map fst cmds)
- then throwDyn (UserError
+ then throwDyn (CmdLineError
("command `" ++ macro_name ++ "' is already defined"))
else do
undefineMacro macro_name = do
cmds <- io (readIORef commands)
if (macro_name `elem` map fst builtin_commands)
- then throwDyn (UserError
+ then throwDyn (CmdLineError
("command `" ++ macro_name ++ "' cannot be undefined"))
else do
if (macro_name `notElem` map fst cmds)
- then throwDyn (UserError
+ then throwDyn (CmdLineError
("command `" ++ macro_name ++ "' not defined"))
else do
io (writeIORef commands (filter ((/= macro_name) . fst) cmds))
writeIORef v_InitDynFlags dyn_flags
if (not (null leftovers))
- then throwDyn (UserError ("unrecognised flags: " ++
+ then throwDyn (CmdLineError ("unrecognised flags: " ++
unwords leftovers))
else return ()
)
-- can't do GHC flags for now
if (not (null minus_opts))
- then throwDyn (UserError "can't unset GHC command-line flags")
+ then throwDyn (CmdLineError "can't unset GHC command-line flags")
else return ()
isMinus ('-':s) = True
putStr ("failed (" ++ str ++ ")\n")
croak
- croak = throwDyn (UserError "user specified .o/.so/.DLL could not be loaded.")
+ croak = throwDyn (CmdLineError "user specified .o/.so/.DLL could not be loaded.")
linkPackage :: PackageConfig -> IO ()
if maybe_errmsg == nullPtr
then return ()
else do str <- peekCString maybe_errmsg
- throwDyn (UserError ("can't find .o or .so/.DLL for: "
+ throwDyn (CmdLineError ("can't find .o or .so/.DLL for: "
++ dll_unadorned ++ " (" ++ str ++ ")" ))
locateOneObj :: [FilePath] -> String -> IO LibrarySpec
-----------------------------------------------------------------------------
--- $Id: DriverMkDepend.hs,v 1.8 2001/03/28 11:01:19 simonmar Exp $
+-- $Id: DriverMkDepend.hs,v 1.9 2001/03/28 16:51:03 simonmar Exp $
--
-- GHC Driver
--
deps | is_source = [ imp_hiboot_v, imp_hiboot, imp_hs, imp_lhs ]
| otherwise = [ imp_hi, imp_hs, imp_lhs ]
- search [] = throwDyn (UserError (src ++ ": " ++ "can't find one of the following: " ++
+ search [] = throwDyn (ProgramError (src ++ ": " ++ "can't find one of the following: " ++
unwords (map (\d -> '`': d ++ "'") deps)))
search ((dir, contents) : dirs)
| null present = search dirs