From 4c3da00bb630fb5d08fae8df7a46cb341020744e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 3 Mar 2013 20:04:24 -0400 Subject: show an error message if garbage is provided to dropunused --- Logs/Unused.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Logs/Unused.hs b/Logs/Unused.hs index 9f1278dd0..bef78a992 100644 --- a/Logs/Unused.hs +++ b/Logs/Unused.hs @@ -62,11 +62,12 @@ withUnusedMaps a params = do unusedSpec :: String -> [Int] unusedSpec spec | "-" `isInfixOf` spec = range $ separate (== '-') spec - | otherwise = catMaybes [readish spec] + | otherwise = maybe badspec (: []) (readish spec) where range (a, b) = case (readish a, readish b) of (Just x, Just y) -> [x..y] - _ -> [] + _ -> badspec + badspec = error $ "Expected number or range, not \"" ++ spec ++ "\"" {- Start action for unused content. Finds the number in the maps, and - calls either of 3 actions, depending on the type of unused file. -} -- cgit v1.2.3