Fix #1505; failure to catch syntax error in :break command
authorSimon Marlow <simonmar@microsoft.com>
Mon, 9 Jul 2007 21:07:06 +0000 (21:07 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Mon, 9 Jul 2007 21:07:06 +0000 (21:07 +0000)
compiler/ghci/InteractiveUI.hs

index c574a8a..169168f 100644 (file)
@@ -1642,14 +1642,17 @@ breakByModule :: Session -> Module -> [String] -> GHCi ()
 breakByModule session mod args@(arg1:rest)
    | all isDigit arg1 = do  -- looks like a line number
         breakByModuleLine mod (read arg1) rest
-   | otherwise = io $ putStrLn "Invalid arguments to :break"
+breakByModule session mod _
+   = breakSyntax
 
 breakByModuleLine :: Module -> Int -> [String] -> GHCi ()
 breakByModuleLine mod line args
    | [] <- args = findBreakAndSet mod $ findBreakByLine line
    | [col] <- args, all isDigit col =
         findBreakAndSet mod $ findBreakByCoord Nothing (line, read col)
-   | otherwise = io $ putStrLn "Invalid arguments to :break"
+   | otherwise = breakSyntax
+
+breakSyntax = throwDyn (CmdLineError "Syntax: :break [<mod>] <line> [<column>]")
 
 findBreakAndSet :: Module -> (TickArray -> Maybe (Int, SrcSpan)) -> GHCi ()
 findBreakAndSet mod lookupTickTree = do